Hello, I would like to have lat, lon and adress for every adress in germany. The problem with my codesnippet is, that it seems that I get every street as a result, but with large gaps between housenumbers. When I visit osm in my browser, I can see housenumbers on the map which are surprisingly not contained in my csv. But I want all adresses with coordinates, and when I can see adresses in the browser, I know its possible to extract the whole set into a csv. file.

This is my code snippet: osmfilter deutschland.osm --keep="addr:country= and addr:city= and addr:postcode= and addr:street= addr:housenumber=" --ignore-dependencies | osmconvert - --csv="@oname @id @lon @lat addr:country addr:city addr:postcode addr:street addr:housenumber" -o=deutschland.csv

I want complete adresses, or to be more precise: lat, lon, city, street, housenumber. For every housenumber in germany.

Thank you for your professional help.

Greetz

asked 07 Mar '16, 13:10

Stephano007's gravatar image

Stephano007
617710
accept rate: 0%


It would seem as if osmconvert is doing exactly what you asked it to, just not what you actually wanted.

There are a number of obvious misconceptions present in the arguments

  • that every object with a tagged address has addr:country, addr:city and addr:postcode values. That is not the case and while there are some discussions around if it best to add redundant information or not, in practice the information will very very often be missing because it can be derived from administrative and postcode boundaries enclosing the object in question.
  • every address has a addr:street tag: on the one hand addr:place is just as valid when there is no associated street for the address and historically not tagging the street was a legimate option (the nearest street was then considered to be part of the address). Further the street information can be contained in a "associatedStreet" relation which the object with a housenumber is a member of.
  • and naturally there are address interpolations too.

As you can see there is some work and heuristics involved in producing a complete addess hierarchy from OSM data. It could be very well be that a local nominatim installation containing the data for Germany would be an easier and better solution than trying to build it yourself.

permanent link

answered 07 Mar '16, 14:04

SimonPoole's gravatar image

SimonPoole ♦
37.8k13284601
accept rate: 19%

edited 08 Mar '16, 08:15

Thank your for your answer.

Ok, I see the point, looks like a lot of programming. Work, that already seemed to be done by nominatim.

When I have a database, with lets say 100.000 adresses, could Nominatim api provide me with the fitting lat / lon? Automatically, so I dont have to do it manually for every adress? Can Nominatim also write back to DB?

Thank you for your expertise,

Greetz, Stephano

(07 Mar '16, 14:47) Stephano007

Hello SimonPoole, you seem to have a good kind of overview, please answer my questions ^^). I have certain adresses, can I enrich for example 1000 of those adresses with lat/lon by using a local nominatim installation?

Is it possible to automatize this process? So could I connect nominatim to my db or generate a .csv file with it? Because I would like to give adress as input, and get lat/lon as result.

(07 Mar '16, 18:08) Stephano007

Yes, this is possible. Nominatim has a simple HTTP API which you can use for geocoding your addresses.

(07 Mar '16, 18:34) scai ♦

You should also pay attention that there are at least two other options to tag a complete address, at least in Germany:

addr:housenumber=* AND addr:place=xxxx ... for villages and hamlets which are so small that there are no extra street names,

and

OSM relations of type=associatedStreet ... see Relation:associatedStreet in the OSM wiki.

If you are able to read in German, also have a look at this article.

permanent link

answered 07 Mar '16, 16:56

stephan75's gravatar image

stephan75
12.5k453209
accept rate: 6%

1

ahemmm didn't I already point that out? :-)

(07 Mar '16, 16:59) SimonPoole ♦
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:

×15
×10
×8
×4

question asked: 07 Mar '16, 13:10

question was seen: 3,177 times

last updated: 08 Mar '16, 08:15

powered by OSQA