Hi folks, I am new to OSM and spatial data. I downloaded a PBF file for Germany from Geofabrik and imported it into a local Postgres-database using osm2pgsql. I would now like to extract all streets in this file/database and their GPS coordinates in WKT or GeoJSON. However, it seems that streets are fragmented into smaller pieces and I am unsure how to merge these pieces. Also what would be the best approach (tool and data provider) to extract such information? Would it be best to use the PBF-file, the Postgis Database, or even shape-files? asked 11 Jan '16, 09:05 Erechtheus |
If you work with raw OSM data (either in a program you've written yourself, perhaps using the Osmium library, or through a Postgres setup where you have imported the data with osmosis and not osm2pgsql) then you have easy access to the node IDs used by a way; it would then be relatively easy to do something like "if two ways have the same name and share a start/end node, connect them into one object". If you work with geometry data, i.e. OSM imported with osm2pgsql, then you have lost the topology (way ends in node ID X) but you have gained geometry; now it will be easy to run something like "if to ways have the same name and lie within 100 metres of each other, treat them as one object". It depends on what you want to achieve really. Keep in mind that streets often don't have one start and one end point; there are streets shaped like a Christmas tree or having loops, there are streets that are interrupted by a plaza or a piece of another street, or streets with separately mapped parallel lanes. answered 11 Jan '16, 17:11 Frederik Ramm ♦ |