OpenStreetMap logo OpenStreetMap

baditaflorin's Diary

Recent diary entries

I will not explain here all the process, but if people are interested, i can do a short video explaining all the process.

I have used the OSM Postgis Script to load the data in PostGIS. This was made for Stereo70 projection, but can be adapted for wsg84

The result it`s a completely 3D map that you can navigate and see each all of the edits made in one year or for each month (not shown in the video or photos)

3d usage

In this image you can see the ways that have been created or last modified in 2016 (top layer), then 2015, then 2014, then 2013, then 2012, then 2011, 2010,2009,etc

See full entry

This script works in 2 parts.

1. First it will generate from the osm.pbf file the list with all the admin_level=4 (al_4)

Then it will remove the ones that are not closed. Then it will make a polygon from each al_4, using the ST_BuildArea

After it will have a inner join that will search for all the nodes and ways that are a restaurant.

2. Then, using st_contains we are searching to see in what polygon each restaurant fits.

Took 4 seconds to do it for Romania

You can find the query here https://github.com/baditaflorin/osm-postgis-scripts/blob/master/statistics/count_number_of_restaurants_inside_each_al_4.sql

See full entry

Random OSM World Stats

Posted by baditaflorin on 25 March 2016 in English. Last updated on 31 March 2016.

The total lenght of the pedestrian roads in the world is 2.919.220 kilometers

For the tunnels and bridges, i will also present to you the global figure here 114.949 pedestrian tunnels are in the osm planet map 351.099 pedestrian bridges are in the osm planet map

Crossings Name 48872 Paris 27647 Madrid 26310 Milan 18959 Yokohama 16748 Helsinki 15445 Kawasaki 15418 Tokio 13542 Moskau 13117 Portland 13081 Phoenix

Top Tunnels

Count tunnels Name city 4304 MĂĽnchen 2552 Moskau 2255 Berlin 1948 Essen 1792 Paris 1417 Hamburg 1366 Milan 1366 Vienna 1268 Helsinki 1205 London 1091 Zurich 1082 Prag 1021 Stuttgart

Top Bridges

Count Name 3911 Hongkong 3844 Kawasaki 3648 Shenzhen 3544 Kowloon 3535 Tokio 3327 Yokohama 3070 Rotterdam 2330 London 2256 Amsterdam

I made a windows version of the scope.sh script. The script helps you load a osm.pbf file into PostGIS, without needing to know osmosis or other low level tools. The fact is that you want to load and use the data, not think what command line should i use in postgres or osmosis for doing this.

Osm Diary Entry about Osm PostGIS Script Repo

## Github code ## YouTube Tutorial

New Osm Postgis Script – Find duplicated nodes.

The idea of using a single repository where everybody cand find and fork the same Postgis OpenStreetMap schema scripts, is allowing anybody in the world to run a query on every part of the OSM database.

Read more on the project here osm.org/user/baditaflorin/diary/37758 Github code here https://github.com/baditaflorin/osm-postgis-scripts/tree/master

Even if you want to load a city and run a analysis on that town, or you want to find out where are all the duplicated nodes in Mexico, you can reuse the code that other people had created. Or you can add your own script that will be compatible with anybody that will load the osm.pbf with Osmosis.

To make the loading of a osm.pbf more simple, i made the SCOPE loader script for linux users, that allow everybody to create a postgis database without needing to know how to use Osmosis and other command line tools. Youtube tutorial here https://www.youtube.com/watch?v=vhJQbKey9EI

Mexico Example :

In Pgadmin i have run the command to find duplicated nodes on all the nodes that exist in Mexico on a intel octacore, 16 GB RAM Machine

Mexico have 13.000.000 nodes, and the query took 550 seconds to complete. It found 43.000 rows, meaning around 10.000 instances of possible duplicated nodes, ways. For example this building appers on the same location 23 times !!! osm.org/way/376880427#map=18/20.80528/-104.92827

See full entry

Openstreetmap Postgis Script Repository For Osmosis Pgsnapshot Schema - QGIS compatibility scripts

Github code here https://github.com/baditaflorin/osm-postgis-scripts/tree/master

Youtube tutorial here ( 4 minutes ) https://www.youtube.com/watch?v=vhJQbKey9EI

The licence is AGPLV3+

History

Here at Telenav , in the Map Analyst Team we use Postgis a lot.

In the real world, Postgis and OpenStreetMap seems to be used more only in Academics or by people that know a medium or high degree of programming.

I think that we should change that and make more simple the availability of Postgis as a tool that can help us visualize information’s from the OSM database much faster.

3 Ways of making Postgis more easy to use with OSM data

# I. - SCOPE

For this i will release SCOPE ( databaSe Creator Osmosis Postgis loadEr ), a command line tool for easy loading of a osm.pbf file into Postgis, via osmosis

Scope

  • You will find scope in the repo

II. A central place for osm-postgis-scripts

See full entry

The Long name is :

Postgis Openstreetmap Script Repository for Osmosis Pgsnapshot Schema

History

Here at Telenav , in the Map Analyst Team we use Postgis a lot.

In the real world, Postgis and OpenStreetMap seems to be used more only in Academics or by people that know a medium or high degree of programming.

I think that we should change that and make more simple the availability of Postgis as a tool that can help us visualize information’s from the OSM database much faster.

3 Ways of making Postgis more easy to use with OSM data

# I. - SCOPE

For this i will release SCOPE ( databaSe Creator Osmosis Postgis loadEr ), a command line tool for easy loading of a osm.pbf file into Postgis, via osmosis

Scope

  • You can try scope in the repo
  • Also, you will find there a Postgis example that i posted there.

II. A central place for Postgis OSM Scripts

See full entry

Location: Center, Cluj-Napoca, Cluj Metropolitan Area, Cluj, Romania

Turn Restriction part 2

Posted by baditaflorin on 30 December 2015 in English.

I will not elaborate now on the difficulties that i had getting ( either osmconvert or osmfilter removes the timestamp, user_id, leaving me with a extracted file that is 50 MB osm.pbf but cannot do nothing more then do some static statistics.

I cannot see how many where imports, how is evolving in time, nothing.

I could try to get the information via Overpass API that this would mean to query the database fro 500.000 relations

Until i figure out what i can do, i was able only do do reverse geocoding using POSTGIS, tried with the http://www.gadm.org/ dataset in QGIS to count the points in each polygon, but it got stuck after 2 hours at 94 %

I will try to load the GADM dataset in postgis and do reverse geocoding from POSTGIS, so i can have a better lever or details about the spread of the turn restriction in each country

See full entry

I have extracted all the turn_restriction that exist in the planet OSM file In total there are around 500.000 in the OSM Database

2% of them, or around 10.000 relations are broken, most of them because of other people that had added/ modified streets and deleted parts of the restriction relation.

A turn restriction is made of a TO - VIA - FROM relation That means that the relation should be of 3 different elements.

Found over 1000 relations that have a turn restriction relation made of at least 4 members, and going up to 100 members, when the absolute value is a 3 members relation

I have found 9700 turn_restriction relations that are invalid, because users deleted part of the relations, either in editors like ID that does not work people that they will break a relation, or other possibilities

You can see one example here osm.org/relation/1110481/history

I had made a editable Google SpreadSheet where you can see all of the 10000 broken relations, you can download them and report the ones that you had fixed

https://docs.google.com/spreadsheets/d/1ADbJl1QeSQmkfDadwEXtiYbDrYB8a1IT9FPU0ars7U8/edit#gid=0

Location: Center, Cluj-Napoca, Cluj Metropolitan Area, Cluj, Romania

Aim

From my point of view, if 1.000 OSM editors that use JOSM will learn at least one new shortcut that will allow them to save 5 minutes each day, we have 5000 minutes each day. Time that people can use to relax, or they can spend this extra 5000 minutes adding more things to the map.

JOSM Keyboard Shortcuts Cheat Sheet ## Print and Download You can download the full version ( 300 DPI ) from this dropbox link

LATER EDIT: SVG file

Happy Printing ## Request After you print it, p[ease send a photo with it. It would be glad to see in what parts of the world this CheatSheet will Travel.

Technical Details.

I have used Inkscape to design the JOSM Keyboard Shortcuts Cheat Sheet As a start, i have used my 5 year old attempt at a cheat-sheet for Inkscape https://openclipart.org/detail/93745/inkscape-keyboard-layoutv048-colored-path

Final Words

See full entry

Location: Center, Cluj-Napoca, Cluj Metropolitan Area, Cluj, Romania

You can see the Video Explaining the idea here http://youtu.be/YgzuX8juTW4

Text Transcript :

We can make the Turn Restriction tool more automated, by the order that we select the ways that will make out the Turn Restriction.

The first time we select the From The second time we select the Via The Third time we select the To

If you look now, the order is ok But you still need to type the 3 roles, losing ~10 seconds for each TR. My suggestion is to make the Turn Restriction autocomplete the FROM,VIA,TO fields if it detect a logical path between them

If you don`t wanna code that much: Put a experiential feature that allow the autocomplete function to exist, only on the logic :

What was selected first becomes “From”, second becomes “Via”, third becomes “To”. Without a logical check in place. Expert Users will still benefit from this function.

Steps involved in the actual process :

  • Move mouse to the “from” Box -Click on the “from” Box
  • Type at least 2 words, so you will get the “from” suggestion, and not “forward”

  • Move mouse to the “via” Box -Click on the “via” Box
  • Type at least the “v” so you will get the autocomplete suggestion for the “via”

  • Move mouse to the “to” Box -Click on the “to” Box
  • Type at least the “t” so you will get the autocomplete suggestion for the “to”

  • Move mouse to the ok button
  • Click the ok button

A special thanks to all JOSM developers that are making this great tool even greater.

Estatus del proyecto de importación de México

Posted by baditaflorin on 27 October 2015 in Spanish (Español). Last updated on 4 November 2015.

Estatus del proyecto de importación de México

Este documento explica el proceso que tuvimos que usar para importar más la mitad de las municipalidades en México.

  • admin_level=4 significa Provincia (Estado)

  • admin_level=6 significa Municipalidad

Estadísticas rápidas:

En números : Números de nodos/caminos/relaciones borradas

  • 500K / 2k / 500

Números de nodos/caminos/relaciones agregadas

  • 1000K / ~4k / ~1050

Número de horas dedicadas :

  • 200+

Número de municipalidades agregadas:

  • 1000+

Este anuncio está dividido en los pasos que se tuvieron que hacer para lograr la importación. Desde el inicio me gustaría mencionar que es un proceso de aprendizaje y todo el tiempo nos encontramos aprendiendo. Si encuentras algo que no consideras óptimo o si tienes una sugerencia de cómo hacerlo de manera distinta por favor avísanos.

Paso 0 : Transformación de Datos

El proceso está ilustrado en la página Wiki Mexico’s Administrative Divisions Import Project

Paso 1 : Pensar en el flujo del proceso

Debido a cuestiones de tiempo decidimos importar por el momento 21 de las 32 provincias

Tuvimos ayuda de las personas que hicieron la importación de Puerto Rico y me gustaría agradecerles el apoyo y ayuda que nos han dado para esta importación

http://wiki.openstreetmap.org/wiki/Puerto_Rico_Projects/Puerto_Rico_Legal_Boundaries_Import

La diferencia fue que tuvimos los datos un poco más complicados porque no empezamos con un mapa limpio, tuvimos un mapa que también tenía ya límites en admin_level=4 , admin_level=6, admin_level=7 8 9 10

Una de las dificultades técnicas que tuvimos al principio fue esta:

See full entry

Mexico boundaries import status.

Posted by baditaflorin on 26 October 2015 in English. Last updated on 4 November 2015.

This document explain the process that we had used to import more then half of the municipalities in Mexico.

  • admin_level=4 means Province ( State )
  • admin_level=6 means Municipality

Short stats :

In Numbers : Number of nodes/ways/relations deleted

  • 500K / 2k / 500

Number of nodes/ways/relations added

  • 1000K / ~4k / ~1050

Number of hours spend :

  • 200+

Number of municipalities added :

  • 1000+

The post is broken down into the steps that we had done to accomplish the import. From the start, i want to point out that this is a learning process, and we are learning all the time. If you find something thay you consider suboptimal, or you have a suggestion of how to do something in a different way, please do tell.

Step 0 : Data Transformation

The process is illustrated in the wiki page Mexico’s Administrative Divisions Import Project

Step 1 : Think at the workflow of the process

We had help from the people that did the Puerto Rico import, and I want to thank them for all the support and help that they had given to us for this import.

http://wiki.openstreetmap.org/wiki/Puerto_Rico_Projects/Puerto_Rico_Legal_Boundaries_Import

The difference was that we had the data a little more complicated, because we did not start with a clean map, we had a map that also had admin_level=4 , admin_level=6, admin_level=7 8 9 10 boundaries already in place.

One of the technical difficulties that we had in the beginning was this :

  • Find solution on how to deal with the ways that also have another relation in the way ( admin level 4 and 6, let`s say ). That means that we cannot delete them, because level 4 relation depends on the same way and when we will do the import it will create duplicated ways along the line If this is not done by script, we need to manually add around 500 boundaries to the new ways and recreate some relations. ( see the task at Step 4 that needed 70 hours )

See full entry

Location: General Francisco R. Murguía, Zacatecas, Mexico

When you want to do a import, and you start with a SHP file, there are 3 challenges that i had identified :

How do you convert and split the file, in such a way that a way will not be longer then 2000 points ? How do you remove the line duplicates after you explode the file ( at first all of the municipality is a polygon, that means that at common borders, there will actually be 2 ways.

How do you elevate the properties of the shp file, now the information is on the way, and you want to move this information into the relation.

I only get the data per continents, for some types of roads. for europe i only got them for 6 types, because osmosis is not able to load the whole Europe file, at least with a server that have 16 GB RAM and octacore processor. I had a deadline, and from my estimation would have took more then 2 days to load the whole europe, so i had used osmfilter and osmconvert to extract different types of highway types

text