This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

How to get number of Lane from OSM?

0

Hello,

I am using OSM for my project, I have downloaded data from http://download.geofabrik.de/ in the OSM file and imported the data in POSTGIS, In the planet_osm_roads, I am not able to see any key realted to lanes.

Can you please help me get the information about the number of lanes from OSM?

asked 15 May '19, 18:54

gautamshahi's gravatar image

gautamshahi
11112
accept rate: 0%


One Answer:

1

By default osm2pgsql will not create a "lanes" column. You can either provide a modified .style file that contains the "lanes" attribute when running osm2pgsl (with the -S option), or you can run osm2pgsql with the --hstore option which will result in a "tags" column that has all tags that don't have extra columns to themselves. You will then be able to access the lanes tag with the syntax tags->'lanes' in your SQL query.

Of course, less than 10% of all highway objects in OSM have a lane tag so you won't find it everywhere.

answered 15 May '19, 21:07

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

Source code available on GitHub .