<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>EPI-USE Stationery</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.5764" name=GENERATOR></HEAD>
<BODY style="FONT-SIZE: 10pt; COLOR: #000000; FONT-FAMILY: Trebuchet MS" 
background="">
<DIV>Hi<BR>I hope someone can put me on the right track. I'm new to this list 
and new to PostGis and <SPAN class=013303620-26092009>to </SPAN>Spatial 
Databases.</DIV>
<DIV> </DIV>
<DIV>I want to do <SPAN 
class=013303620-26092009>R</SPAN>everse <SPAN 
class=013303620-26092009>G</SPAN>eocoding on OpenStreetMap.org data. The 
requirement is: <BR>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.</DIV>
<DIV> </DIV>
<DIV>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.</DIV>
<DIV> </DIV>
<DIV>I have been exploring queries similar to this one:<BR>"Select name FROM 
planet_osm_line WHERE distance (way, geomfromtext('POINT(-9393780.6113322 
3993956.8318506)', 900913)) < 200;"</DIV>
<DIV> </DIV>
<DIV>But I guess where I get lost is that: <BR>- I need to search in all the 
relevant tables for line, point and roads<SPAN 
class=013303620-26092009>?</SPAN><BR>- I need to sort according to distance from 
the given lat/long to get the closest point?<BR>- I need to use a <SPAN 
class=013303620-26092009>'</SPAN>bounding box<SPAN 
class=013303620-26092009>'</SPAN> but not sure how to do it<SPAN 
class=013303620-26092009>. I guess a bounding box is needed to limit the search 
to a restricted area</SPAN>?</DIV>
<DIV> </DIV>
<DIV>Any help will much be appreciated<SPAN 
class=013303620-26092009>!</SPAN><BR>Rickus</DIV></BODY></HTML>