[Geocoding] Take House Numbers from TIGER on Reverse Geocoding

Sarah Hoffmann lonvia at denofr.de
Thu Aug 23 20:12:19 BST 2012


On Thu, Aug 23, 2012 at 10:50:57AM +0300, Silviu Simon wrote:
> Hello,
> I recently did an import of USA into my nominatim server database
> and I've noticed that my searches on reverse-geocoding do not return
> house numbers. I found out that in order to get house numbers,
> nominatim uses TIGER on search, so I'm trying to make the program
> use house numbers from TIGER on reverse geocoding.
> I've noticed that this line
> 
> $aAddress = getAddressDetails($oDB, $sLanguagePrefArraySQL,
> $iPlaceID, $aPlace['country_code']);
> 
> line 153 in website/reverse.php is responsible for building
> @aAddress which contains all information about the address and is
> then parsed in lib/template/address-xml.php to create the result
> xml.
> I'm thinking I should make a sql query in the tiger database to get
> the house numbers, and then add it to $aAddress.
> Am I correct? I would appreciate any help you could give me on this matter.

getAddressDetails() will get you a nicely formatted TIGER address when you
give it a $iPlaceID that is a place_id in the TIGER address table 
(location_property_tiger). This part of the code does not need to be changed.
The only thing you need to do is find this nearest place_id.

As twain already mentionened, the easiest way would most likely be to add
an index on the centroid column of the location_property_tiger table and
look for the nearest place_id. Add this around 111, compare with the result
the while loop above returned and choose whichever suits you better. That
is pretty much all.

Sarah



More information about the Geocoding mailing list