[OSM-dev] Defining the area of a country / What country is a LatLon in.

Andy Allan gravitystorm at gmail.com
Mon Nov 19 17:00:44 GMT 2007


On Nov 19, 2007 3:42 PM, Marcus Wolschon <marcus at wolschon.biz> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
>
> Dear everyone,
>
> I was looking into finding out if a given point is inside
> a given country (or "what country is this node in").
> (To interpret addresses and country-specific speed-limits.)
>
> Is there a definitive way to do this yet?

No. But there's rather a definitive way for anything in OSM ;-)

> What I can see is that the borders are multiple ways of
> boundary=administrative and "right|country"=XXX and
> "right|country"=YYY .
>
> How am I to
> a) get all border-pieces without downloading all of the planet.

Best to download the planet, that way you'll get them all.

> b) interpret them (they may be incomplete e.g. in the baltic see).

With difficulty. See also Africa or anywhere else, really.

> We have a defined tag "place=country;name=XXX" and it makes no
> sense to have multiple ways of tagging the same thing.

Is this for nodes? In which case it's necessary, since it's the easy
leg up to putting a country on the map without needing an entire
border for it. We don't like high barriers to entry.

> Should I
> 1) join the existing way-parts into areas with place=country (very long
> way with many points)

No, please don't. Long ways are frowned upon as they are hard to edit.

> 2) join the border-segments in a new relation containing an ordered list
>    of ways (relations are unordered), document this and remove
>    place=country from the wiki as obsolete

place=country isn't obsolete yet.

> 3) ...

a) Starting with the world_boundaries shapefiles, set up a mechanism
to detect which country a given point (or lat/long) is in
b) Then come up with a mechanism to use the boundaries in OSM, which
bears in mind that the shapefiles are inaccurate but complete, and the
OSM boundaries are (potentially) more accurate buy woefully incomplete
c) Profit, of course

I know that at least one other OSMer is working on this, but I don't
know how far he's got.

Cheers,
Andy




More information about the dev mailing list