OpenStreetMap Forum

The Free Wiki World Map

You are not logged in.

#1 2009-03-03 15:35:32

xintao
Member
Registered: 2009-02-19
Posts: 46

About the NameFinder or Geocoding in OSM

Hello!

When we type a street name in the Search area of http://www.openstreetmap.com/, then we can get a list of address, which are the cities including the typed street.
Does it mean that OSM has such a database as shown below, based on which OSM service can find the corresponding city and country of a given street name, right? 

    CountryName,    CityName,     StreetName
    Sweden,            Stockholm,    Vasagatan
    Sweden,            Stockholm,    Sveavägan
    ...                      ...                 ...
   Sweden,            Uppsala,         Kungsgatan
    ...                      ...                 ...       

I am not sure whether this kind of dataset exists, and the accessibity of it. If I want to find out the city and country a named street belongs, how can I do it based on my own algorithm and OSM dataset? (In OSM data, the name tag does not include the city name as well as country name)

Similarly, given a point (latitude, longitude), how can I efficiently find out which street the point is closest to? In doing this, we need a spatial index for OSM data. For instance, we need to know how many cities a country has, and the boundary of every city. Based on these, we can position the point in a city according to the city's boudary, and then we can find the street closest to the given point quickly. Am I right? If so, does such a dataset exist?

    CountryName,    CityName,     Boundary
    Sweden,            Stockholm,    ([x0 y0], [x1 y1], [x2 y2] ...)
    Sweden,            Uppsala,        ([x0 y0], [x1 y1], [x2 y2] ...)
    ...                      ...                ...

Many thanks in advance!

Xintao

Offline

#2 2009-03-03 23:32:03

emj
Member
From: .se (59.3N17.99E) 0735969076
Registered: 2006-06-18
Posts: 949

Re: About the NameFinder or Geocoding in OSM

No such DB, the search box (which is called namefinder) does this by getting the closest city node. Areas are not available either, the best place to get these would be wikimapia but it isn't copyleft friendly.

You should ofcourse use a spatial database if you want to do these things with openstreetmap, there are instructions on how to install postgis on the wiki. http://wiki.openstreetmap.org/wiki/Mapnik

Offline

#3 2009-03-04 10:28:21

xintao
Member
Registered: 2009-02-19
Posts: 46

Re: About the NameFinder or Geocoding in OSM

Hi emj, thanks for your reply and help. I will refer to the postgis later. Thank you.

Offline

#4 2009-03-05 12:15:17

xintao
Member
Registered: 2009-02-19
Posts: 46

Re: About the NameFinder or Geocoding in OSM

Hi emj, I am sorry, but I still want to figure it out that, given a street name, how OSM get the city names that include the given street? For instance, give an street named Kungsgatan, the cities which include Kungsgatan may be Stockholm, Uppsala, Gävle and etc.  You said that OSM does this by getting the closest city node. Could you please give some details about it? E.g what is the city node, and how to access it?

Thanks a lot.

Xintao

Offline

#5 2009-03-06 01:40:57

emj
Member
From: .se (59.3N17.99E) 0735969076
Registered: 2006-06-18
Posts: 949

Re: About the NameFinder or Geocoding in OSM

city node is a node tagged with
place=city; name=Stockholm 
or
place=suburb; name=165 dags att hitta hem

Read more about name finder, it uses insanely complicated php code to parse the planet.osm and dump it to a custom databse which then is used to give you these results.

Offline

Board footer

Powered by FluxBB