[Geocoding] local US nominatim reverse geocode does not return a state unless lat/lon is close to the state centroid
John Shimer
jshimer at saucontech.com
Sun Jan 11 14:05:03 UTC 2015
Hi Sarah,
I tried to follow your instructions. The importing of the relation
seemed to go fine. When I attempted to verify that I could find the
state with the a search query, I believe the original node for PA came
back and not the imported relation. Does this mean that my OSM data is
broken?
request:
http://myserver/nominatim/search.php?q=Pennsylvania&format=xml&addressdetails=1
response:
<?xml version="1.0" encoding="UTF-8" ?>
<searchresults timestamp='Sun, 11 Jan 15 08:49:40 -0500'
attribution='Data © OpenStreetMap contributors, ODbL 1.0.
http://www.openstreetmap.org/copyright' querystring='Pennsylvania'
polygon='false' exclude_place_ids='112071'
more_url='http://10.5.1.100/nominatim/search?format=xml&exclude_place_ids=112071&accept-language=en-US,en;q=0.8,nl;q=0.6&addressdetails=1&q=Pennsylvania'>
<place place_id='112071' osm_type='node' osm_id='316987717'
place_rank='8'
boundingbox="38.4099889,43.5299889,-80.2878831,-75.1678831"
lat='40.9699889' lon='-77.7278831' display_name='Pennsylvania, United
States of America' class='place' type='state' importance='0.66'
icon='http://10.5.1.100/nominatim/images/mapicons/poi_boundary_administrative.p.20.png'>
<state>Pennsylvania</state><country>United States of
America</country><country_code>us</country_code></place></searchresults>
I also attempted a solution by expanding my import scope by using a
North America (complete US and Canada) file from
http://download.geofabrik.de/, and the results were the same. It seems
like at least for the US, these extracts are not very well suited for
Nominatim import. My next attempt will be to load from a complete planet
file.
Thanks,
John
On 01/09/2015 01:48 PM, Sarah Hoffmann wrote:
> Hi John,
>
> On Fri, Jan 09, 2015 at 12:02:18PM -0500, John Shimer wrote:at
>> Hi,
>>
>> I have a local Nominatim instance with a US/Pennsylvania extract
>> loaded. When a make reverse geocode requests, I never get a state
>> back unless the coordinates are close to the centroid of the state.
> It's most likely that the extract was cut a bit tight and didn't include
> the full state boundary. You can add it to your database after the import
> like this:
>
> * Find the relation of Pennsylvania on the osm website and note the ID
> (it's that http://www.openstreetmap.org/relation/162109)
> * Import the relation to your database like that:
> ./utils/update.php --import-relation 162109 --index
> * Verify that you can find the state now and it will give you back the
> relation. Sometimes OSM data gets broken and then this part will fail.
> * When all is well, you have to reindex everything.
> Mark for indexing:
> psql -d nominatim -c "select place_force_update(place_id) from placex where osm_type = 'R' and osm_id = 162109"
> And reindex:
> ./utils/update.php --index --index-instances 2
>
> The last part is really slow, I' m afraid. You can also simply reimport
> the database with an extract that is a bit larger than the state you need.
>
> Sarah
>
>> I am aware that the openstreetmap version of Nominatim always
>> returns valid results for my test coordinates, so what am I doing
>> wrong?
>>
>> for example... http://myserver/nominatim/reverse.php?format=xml&lat=40.658773&lon=-75.295520
>>
>> returns
>>
>> <reversegeocodetimestamp="Fri, 09 Jan 15 11:40:46
>> -0500"attribution="Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright"querystring="format=xml&lat=40.658773&lon=-75.295520">
>> <resultplace_id="637091"osm_type="way"osm_id="19996066"ref="Baglyos
>> Circle"lat="40.6608768"lon="-75.2980609">
>> Baglyos Circle, Farmersville, Northampton, 18020, United States of America
>> </result>
>> <addressparts>
>> <road>Baglyos Circle</road>
>> <hamlet>Farmersville</hamlet>
>> <county>Northampton</county>
>> <postcode>18020</postcode>
>> <country>United States of America</country>
>> <country_code>us</country_code>
>> </addressparts>
>> </reversegeocode>
>>
>> while
>>
>> http://myserver/nominatim/reverse.php?format=xml&lat=40.736505&lon=-77.884580
>>
>> returns
>>
>> <reversegeocodetimestamp="Fri, 09 Jan 15 11:45:27
>> -0500"attribution="Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright"querystring="format=xml&lat=40.736505&lon=-77.884580">
>> <resultplace_id="320232"osm_type="way"osm_id="11842937"ref="Ward
>> Alley"lat="40.735668"lon="-77.8842848">
>> Ward Alley, Pine Grove Mills, Centre, Pennsylvania, 16801, United
>> States of America
>> </result>
>> <addressparts>
>> <road>Ward Alley</road>
>> <hamlet>Pine Grove Mills</hamlet>
>> <county>Centre</county>
>> <state>Pennsylvania</state>
>> <postcode>16801</postcode>
>> <country>United States of America</country>
>> <country_code>us</country_code>
>> </addressparts>
>> </reversegeocode>
>>
>> Thanks,
>> John
>> _______________________________________________
>> Geocoding mailing list
>> Geocoding at openstreetmap.org
>> https://lists.openstreetmap.org/listinfo/geocoding
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/geocoding/attachments/20150111/637dab67/attachment.html>
More information about the Geocoding
mailing list