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's gravatar image

Erechtheus
41112
accept rate: 0%


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.

permanent link

answered 11 Jan '16, 17:11

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
67.0k806161040
accept rate: 24%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×87
×69

question asked: 11 Jan '16, 09:05

question was seen: 2,208 times

last updated: 11 Jan '16, 17:11

powered by OSQA