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
Answer
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
No comments:
Post a Comment