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 related to lanes.

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

I have visited Getting lane data from OSM

Number of lanes in road data


2 Answers 2


Looking at the .PBF file for Colorado, there are 2 line layers when importing into a QGIS project.

The colorado-latest lines (NOT multistring) contains the HSTORE-type column "other_tags"

In there, you can see this value: "bicycle"=>"yes","cycleway"=>"lane","cycleway:both:buffer"=>"yes","lanes"=>"2","maxspeed"=>"20 mph","maxspeed:type"=>"sign","surface"=>"asphalt"

This contains the lanes=>"2" value.

Ensure your PostgreSQL database has the HSTORE extension enabled.

You can then query the other_tags field with something like:

select * from colorado-latest where other_tags::hstore -> 'lanes' >= '2'

Notice you are casting the other_tags column to hstore in the query (not likely to show up as hstore when loaded via qgis, and you can also alter the table type after loading to avoid having to cast if desired), and you are also using the hstore -> operator.

Query examples: http://www.postgresqltutorial.com/postgresql-hstore/

HSTORE documentation: https://www.postgresql.org/docs/9.0/hstore.html

  • Great, Thanks, can we fetch only one pair from here using Python or postgis? May 16, 2019 at 19:15
  • @GAUTAMKISHORESHAHI just added some HSTORE query info... let me know if it works for you. May 16, 2019 at 20:54

You could add the lanes tag to your default.style file before importing to get a separate column for it.

See How to make osm2pgsql import a tag? for details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.