[OSM-dev] country boundary polygons
marcus.wolschon at googlemail.com
marcus.wolschon at googlemail.com
Tue Mar 31 14:09:22 BST 2009
Hello Andy.
Have you looked at how I did this in:
http://travelingsales.svn.sourceforge.net/viewvc/travelingsales/trunk/osmnavigation/src/org/openstreetmap/travelingsalesman/navigation/traffic/
it is documented here:
http://apps.sourceforge.net/mediawiki/travelingsales/index.php?title=TrafficRuleManager
"
For each country this test involves first to check with the bounding-box of
the country. If we are not within the bounding-box, we cannot be inside
that country.
Next we test if the node or way is tagged with "is_in:country" or "is_in"
and contains either the country-name (case insensitite) or the uppercase
ISO3166 -code of the country.
Next we load the prepared border-polygon of the country and cache it.
Loading the polygon take a lot of time but checks with it are fast.
"
I'll add a fourth step to be taken if the distance to the simple polygon
is below it's simplification-threshold and use the OSM-ways that make up
the
border in that section then.
It never compares against the full OSM border of the country.
Marcus
On Tue, 31 Mar 2009 13:48:27 +0100, Andy Deakin <andy.deakin at pcmend.net>
wrote:
> 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
More information about the dev
mailing list