And the wife of the man from the Vuliha tower sent with a list for the New Year’s celebration

And the wife of the man from the Vuliha tower sent with a list for the New Year’s celebration

In the masterpiece cartoon “Last year’s snow was falling”, a strict but authoritative wife sent her husband to the forest to collect a Christmas tree. The main character is not particularly focused on the main goal of his New Year’s walk and was distracted on the way by everything possible. Let’s imagine now, after 40 years, their house fell under the renovation program, and they moved almost to the center of Moscow and now live in the tower of a typical Soviet building. And his wife sent him, this time with a shopping list for the New Year.

Like a demotivated programmer, a man is prone to procrastination. He did not complete the assignment and aimlessly bypassed everything of any interest within a radius of 1.5 km from the apartment in the Vuliha tower.

I told how to “prepare” open OpenStreetMap data in “Where is a 15-minute walk from the house to the metro in Moscow and how to distinguish panel houses …”, let’s not get into the details before the holiday. This time, only houses built according to the typical “Hive tower” project are needed to calculate the distances:

create table focus_on_building as 
  select distinct id,type 
    from geometry_global_view  
    where tags->'design:ref'='Башня Вулыха';

The project of the house in the form of a tower is suitable for telling a fairy tale – it is usually single-access and pedestrian paths from the entrance to the building to the POI on the outskirts are almost in the shape of snowflakes. And for people who lived in the era of the USSR, these were some of the most comfortable apartments from typical new buildings.

Soon the fairy tale is revealed, and soon the code is written. The library for calculating distances GraphHopper is able to output a route in the form of broken lines, and we can easily convert its object into a WKT string (Well-known text representation of geometry)

String path = bestRoute.getPoints().toLineString(false).toString();

And for saving the calculated route to the PostGIS table:

osmworld=# \d footpath_distance 

    Column     |           Type            | 
 building_id   | bigint                    | 
 building_type | table_reference           | 
 poi_id        | bigint                    | 
 poi_type      | table_reference           | 
 distance      | geometry(LineString,4326) | 

GraphHopper route with WKT easily turns into a line:


You can add even more of a winter fairy tale if you approximate the neighborhood with hexagons of H3 geo-indexes H_3_CORE.gridDistance( centreIdx, H_3_CORE.latLngToCell(, ghPoint.lon,8))<MAX_DISK_DISTANCE . The similarity of walking distances around the house with a snowflake will be closer.

One of the possible ways is the way of the godfather from the cartoon. There are many interesting things in the center of the capital, certainly more than in any winter forest.

In the data of the OSM of the capital, 293 towers of Vulikha were found, so it is possible that he was walking in other neighborhoods:

I will download the data in GeoJSON and share with you:

\copy (select json_build_object('type', 'FeatureCollection','features', json_agg(json_build_object('type', 'Feature','geometry', st_AsGeoJSON(path)::json))) from (select distance path from footpath_distance) fp) to '~/moscow_snowflake.json';

So far, it seems from the outside that there is no particular practical benefit in this, except for New Year’s mood. But it just seems like it 😉 See you in the new year, it will be more interesting!

If you’re just looking for useful information, I’ve been posting here all year “uncensored” models and data useful for housing, here are just a few:

And this year began with the fact that I shared my project How to put the whole world in an ordinary laptop: PostgreSQL and OpenStreetMap. and spoke at PGConf.Russia 2023 before a friendly audience of PostgreSQL specialists. During the year, I got a lot of practice in working with OpenStreetMap data, and also won the “search deoptimization” jackpot. He left the usual “hothouse” environment of the office in order to gain new experience for himself and learn new skills necessary to survive in a changing reality, where from the side it may seem that “I went after the Christmas tree, but it will soon pass the skin of a hare.”

Dear programmers and readers who sympathize with us, I wish everyone a happy New Year!

Related posts