OpenStreetMap Forum

The Free Wiki World Map

You are not logged in.

#1 2019-02-05 12:49:43

jeremy_rutman
Member
Registered: 2019-01-14
Posts: 24

iso 3166-2 state codes

Is there a simple method for determination of iso 3166-2 'state' codes for osm nodes using nominatim? I have run across  mappings from iso 3166-2 to text  and the 'pycountry' module which I imagine will amount to the same , but am  curious if there is not an in-osm method for this conversion.
I saw a tool called 'cosmogony' (https://github.com/osm-without-borders/cosmogony)  , is this the way to go if text conversion runs into trouble?

I am further interested in what geonames calls 'admin2' codes, I am not sure what the iso equivalent is (it seems the geonames admin1 is largely equivalent to iso-3166-2) .

Last edited by jeremy_rutman (2019-02-06 22:36:25)

Offline

#2 2019-02-05 18:06:48

alester
Member
Registered: 2011-09-21
Posts: 252

Re: iso 3166-2 state codes

jeremy_rutman wrote:

Is there a simple method for extraction of iso 3166-2 'state' codes from osm records? I have run across  mappings from iso 3166-2 to text  and the 'pycountry' module which I imagine will amount to the same , but am  curious if there is not an in-osm method for this conversion.
I saw a tool called 'cosmogony' (https://github.com/osm-without-borders/cosmogony)  , is this the way to go if text conversion runs into trouble?

I am further interested in what geonames calls 'admin2' codes, I am not sure what the iso equivalent is (it seems the geonames admin1 is largely equivalent to iso-3166-2) .

It isn't completely clear what your goal is. Do you just want a list of any ISO 3166-2 codes being used in OSM? If so, then I don't think you'll find any. The second part of an ISO 3166-2 code may be what's used in addr:state or addr:province tags, but I don't think the full ISO 3166-2 code (e.g. CA-ON or US-NY) would be used in any OSM tags.

Or do you just want a list of ISO 3166-2 codes? If so, you can get that from the ISO site here.

Offline

#3 2019-02-05 18:23:12

wambacher
Member
From: Schlangenbad/Wambach, Germany
Registered: 2009-12-16
Posts: 16,306
Website

Offline

#4 2019-02-06 10:05:58

jeremy_rutman
Member
Registered: 2019-01-14
Posts: 24

Re: iso 3166-2 state codes

alester wrote:

It isn't completely clear what your goal is..

Given a node/way/relation , determine within which iso 3166-2 it is contained (and return all if its in more than one, none if there are none)

Last edited by jeremy_rutman (2019-02-06 10:06:47)

Offline

#5 2019-02-11 11:47:27

kocio
Administrator
From: Warszawa
Registered: 2013-09-04
Posts: 3,274
Website

Re: iso 3166-2 state codes

I paste here what was accidentally reported:

jeremy_rutman wrote:

and a further, related question - given a lat-long, is there a way to determine which country its located in ?

Offline

Board footer

Powered by FluxBB