[OSM-dev] country boundary polygons
Andy Deakin
andy.deakin at pcmend.net
Tue Mar 31 13:48:27 BST 2009
Hi,
No major breakthrough here, but if anyone is interested in a quick and
dirty 'what country is lat,lon in' I have created a simple method.
Lookups have been taking about 0.00002 seconds, and it involves a binary
lookup file (25MB) at 1/20th of a degree resolution. Boundaries need
further processing for an exact result. If you were only interested in a
smaller area (e.g. Europe) then it could be made much smaller.
Details available here:
http://www.handyandy.org.uk/blog/2009/03/31/what-country-are-you-in/
Andy
>> Hi,
>>
>> I am looking for a simple answer to the question 'what country is
>> lat+long in?', and for this I need the country borders as polygons.
>>
>
> For the technical part, I had extremely good and fast (~0.1s) result with one
> single postgres/postGIS query :
> echo "select osm_id,name,admin_level from planet_osm_polygon where way &&
> transform('SRID=4030;POINT(6.0333 45.7666)',900913) and
> _ST_Contains(way,transform('SRID=4030;POINT(6.0333 45.7666)',900913));" |
> psql gis
> osm_id | name | admin_level
> --------+--------------+-------------
> -7407 | Haute-Savoie | 6
> -8655 | Rhône-Alpes | 4
> -74368 | Cusy | 8
> (3 rows)
>
>
More information about the dev
mailing list