[postgis-users] Help: Reverse Geocoding with OSM data

Rickus rickus at mnt-direct.com
Sat Sep 26 14:11:20 PDT 2009


EPI-USE StationeryHi
I hope someone can put me on the right track. I'm new to this list and new
to PostGis and to Spatial Databases.

I want to do Reverse Geocoding on OpenStreetMap.org data. The requirement
is:
Given a lat/long the query needs to return the closest road and point and
suburb, city etc. The biggest requirement is that it should be very fast.

I have a PgSQL/PostGis DB Server running with a subset of the OpenStreetMap
database. In the OSM DB there are tables with 'planet_osm_point',
'planet_osm_roads', and 'planet_osm_line' data. I also added a 900913
mercator projection to the 'spatial_ref_sys' table.

I have been exploring queries similar to this one:
"Select name FROM planet_osm_line WHERE distance (way,
geomfromtext('POINT(-9393780.6113322 3993956.8318506)', 900913)) < 200;"

But I guess where I get lost is that:
- I need to search in all the relevant tables for line, point and roads?
- I need to sort according to distance from the given lat/long to get the
closest point?
- I need to use a 'bounding box' but not sure how to do it. I guess a
bounding box is needed to limit the search to a restricted area?

Any help will much be appreciated!
Rickus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20090926/983790c8/attachment.html>


More information about the postgis-users mailing list