2

I have imported OpenStreetMap data for the country Switzerland via osmosis in my MySQL database.

Now I want to look for a specific address in that database, but I can't find a way to get the whole address (street, postcode, town ..).

For example, the address I'm talking about is: Street: Archstrasse, town: Grenchen, postcode: 2540, county: Amtei Solothurn-Lebern, country: Schweiz.

<!-- language: lang-sql -->
select * from current_way_tags where way_id = 162530695;> &nbsp;

+-----------+----------+-------------+&nbsp;

| way_id    | k        | v           |&nbsp; 

+-----------+----------+-------------+&nbsp;

| 162530695 | cycleway | lane        |&nbsp; 

| 162530695 | highway  | primary     |&nbsp;

| 162530695 | name     | Archstrasse |&nbsp;

| 162530695 | ref      | 5           |&nbsp;

+-----------+----------+-------------+&nbsp;
  • thx for the link. But i mean on the Database side. i mean how to get all the Data for a given Adress. – Billy Sanders Apr 21 '16 at 16:07
  • can you edit the question to make what you are trying to do clearer – Ian Turton Apr 21 '16 at 16:08
  • hi @iant, i have edited my question. I hope its clearer for you now. – Billy Sanders Apr 22 '16 at 9:02
3

Take the link from iant's comment and click on details. On the database side, Nominatim calculates an address hierarchy. It does this by looking at address tags on the object, associatedStreet relation on the object if present, boundary relations containing the object in question, and places containing the object or being near it. And maybe more.

More background information:

Don't forget that there are other OSM-based search engines. Some of them are based on Nominatim, others aren't.

  • thx scai for your answer. Addresses with Address Tag are easy. i got this already implemented in my software. But sadly not all Addresses are marked as Adresses. The street in my question is a highway. so i fount the street but i didnt find a way to get the other information. – Billy Sanders Apr 22 '16 at 9:51
  • @BillySanders: Take a look at Nominatim's address hierarchy for your street to get a better understanding. As you can see, the address hierarchy contains various places and relations as already explained in my answer. – scai Apr 22 '16 at 10:20
  • Thx for the Answer. Last question. i already taked a look at the address hierarchy of the street am looking for. In my Database i find the Street/Way "Archstrasse" with way_id "116169254". My Problem is i dont know how to find the related relations like "1683510". There is no foreign_key relation between ways and relations in the Database. Maybe you know how to bypass this problem. – Billy Sanders Apr 22 '16 at 12:30
  • Correct, there is only a spatial correlation. Relation 1683510 contains way 116169254. This is implicit and can be obtained via a corresponding query of a spatial database. That's what Nominatim is doing during import, performing lots of calculations for generating the address hierarchy. If you don't want to reinvent the wheel then make use of Nominatim's database or take a look at other OSM geocoders. – scai Apr 22 '16 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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