Please note - sorry but I couldn't get the question editor to show my XML so I've had to replace all the '<'s with '[' and all the '>'s with ']' in what follows. If someone knows how to fix this for me please let me know - thanks.
I am building a simple application which, given a worldwide lat/lon, requires details of the nearest city or town, based upon a simple as-the-crow-flies measurement. To achieve this I've chosen to use the OSM nodes which are tagged place='town' or place='city', calculating the spherical distance between my check point and each node's lat/lon. These nodes, according to http://wiki.openstreetmap.org/wiki/Key:place, represent the approximate centre of each town and city and so are ideal for my requirement.
Given my chosen approach, I extracted the data from the Overpass API, using the following requests:
curl http://www.overpass-api.de/api/xapi?node[place=city] -g -o worldcities.osm
curl http://www.overpass-api.de/api/xapi?node[place=town][@timeout=360] -g -o worldtowns.osm -g -o worldtowns.osm
This has given me 2 files of data, which I'm loading (using osm2pgsql), giving me a database which is able to support my distance searching. Each database search will give me back a nearest town/city node, which I then need to display to my application user in text (not on a map), and so I need a location name/description. I want to show more than just the town/city name and so started looking at the is_in tag.
I'm seeing that some of the place nodes have is_in tags I can use directly, such as:
[node id="271344" lat="51.2569570" lon="-1.6233744"]
[tag k="is_in" v="Wiltshire, England, UK"/]
[tag k="name" v="Ludgershall"/]
[tag k="place" v="town"/]
[tag k="wikipedia" v="en:Ludgershall, Wiltshire"/]
[/node]
I can use this to show 'Ludgershall, Wiltshire, England, UK' to my application user.
Others do not have an is_in tag:
[node id="271099" lat="50.9196406" lon="-1.4894631"]
[tag k="name" v="Totton"/]
[tag k="place" v="town"/]
[/node]
Some have an is_in but also have 'component' is_in tags, which contain additional details:
[node id="4085941" lat="52.1363806" lon="-0.4675041"]
[tag k="is_in" v="Bedfordshire"/]
[tag k="is_in:country" v="United Kingdom"/]
[tag k="is_in:country_code" v="GB"/]
[tag k="is_in:county" v="Bedfordshire"/]
[tag k="name" v="Bedford"/]
[tag k="name:lt" v="Bedfordas"/]
[tag k="name:ru" v="Бедфорд"/]
[tag k="place" v="town"/]
[tag k="population" v="80000"/]
[tag k="wikipedia" v="en:Bedford"/]
[/node]
Some only have components and no overall is_in to refer to:
[node id="16664272" lat="52.1365867" lon="-0.9859244"]
[tag k="is_in:continent" v="Europe"/]
[tag k="is_in:country" v="United Kingdom"/]
[tag k="is_in:country_code" v="GB"/]
[tag k="is_in:county" v="Northamptonshire"/]
[tag k="is_in:district" v="South Northamptonshire"/]
[tag k="name" v="Towcester"/]
[tag k="old_name" v="Lactodurum"/]
[tag k="place" v="town"/]
[tag k="wikipedia" v="en:Towcester"/]
[/node]
Some are 'backwards' (it should be 'Surrey, England', not 'England, Surrey'):
[node id="14698916" lat="51.2321130" lon="-0.3247823"]
[tag k="is_in" v="England, Surrey"/]
[tag k="name" v="Dorking"/]
[tag k="place" v="town"/]
[tag k="wikipedia" v="en:Dorking"/]
[/node]
Ideally I need a English name for each, but I'm seeing a mix of languages in some cases:
[node id="18481614" lat="51.8397184" lon="6.6161534"]
[tag k="is_in" v="Kreis Borken,Regierungsbezirk Münster,Nordrhein-Westfalen,Bundesrepublik Deutschland,Europe"/]
[tag k="is_in:continent" v="Europe"/]
[tag k="is_in:country" v="Germany"/]
[tag k="is_in:state" v="North Rhine-Westphalia"/]
[tag k="name" v="Bocholt"/]
[tag k="name:ru" v="Бохольт"/]
[tag k="place" v="town"/]
[tag k="population" v="73696"/]
[tag k="website" v="http://www.bocholt.de"/]
[tag k="wikipedia" v="de:Bocholt"/]
[/node]
I've pretty much come to the conclusion that I can't depend on the data I'm seeing in the is_in tag as it currently stands, there is too much variation in the usage, so I've been working on an alternative solution.
I'm using the area queries which the Overpass API makes available, so given a town node such as:
[node id="271099" lat="50.9196406" lon="-1.4894631"]
[tag k="name" v="Totton"/]
[tag k="place" v="town"/]
[/node]
I can make a query against the API using this request:
http://overpass-api.de/api/interpreter?data=[out:json];is_in(50.9196406,-1.4894631);out;
Which gives me... (sorry that this is quite long...):
{
"version": 0.6,
"generator": "Overpass API",
"osm3s": {
"timestamp_osm_base": "2014-06-05T10:15:01Z",
"timestamp_areas_base": "2014-06-05T01:00:02Z",
"copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."
},
"elements": [
{
"type": "area",
"id": 2438387676,
"tags": {
"name": "Southampton",
"public_transport": "pay_scale_area",
"ref": "SOTON",
"source": "naptan_import"
}
}
,
{
"type": "area",
"id": 3600058447,
"tags": {
"ISO3166-2": "GB-ENG",
"admin_level": "4",
"boundary": "administrative",
"name": "England",
"name:be": "ÐнгліÑ",
"name:cy": "Lloegr",
"name:de": "England",
"name:el": "Αγγλία",
"name:en": "England",
"name:es": "Inglaterra",
"name:fr": "Angleterre",
"name:gd": "Sasainn",
"name:gv": "Sostyn",
"name:hsb": "Jendźelska",
"name:hu": "Anglia",
"name:it": "Inghilterra",
"name:lt": "Anglija",
"name:nl": "Engeland",
"name:pl": "Anglia",
"name:pt": "Inglaterra",
"name:ru": "ÐнглиÑ",
"name:sv": "England",
"name:uk": "ÐнгліÑ",
"name:vi": "Anh",
"name:zh": "è‹±æ ¼è˜",
"name:zh-classical": "è‹±æ ¼è˜",
"name:zh-simplified": "è‹±æ ¼å…°",
"name:zh-traditional": "è‹±æ ¼è˜",
"old_name:vi": "Anh Quốc",
"type": "boundary",
"wikidata": "Q21",
"wikipedia": "en:England"
}
}
,
{
"type": "area",
"id": 3600062149,
"tags": {
"ISO3166-1": "GB",
"ISO3166-1:alpha2": "GB",
"ISO3166-1:alpha3": "GBR",
"ISO3166-1:numeric": "826",
"admin_level": "2",
"boundary": "administrative",
"currency": "GBP",
"driving_side": "left",
"flag": "http://upload.wikimedia.org/wikipedia/commons/a/ae/Flag_of_the_United_Kingdom.svg",
"int_name": "United Kingdom",
"name": "United Kingdom",
"name:ab": "Британиа Ду",
"name:af": "Verenigde Koninkryk",
"name:ak": "United Kingdom",
"name:als": "Vereinigtes Königreich",
"name:am": "ዩናá‹á‰µá‹µ ኪንáŒá‹°áˆ",
"name:an": "Reino Unito",
"name:ang": "GeÄned CynerÄ«ce",
"name:ar": "المملكة المتØدة",
"name:arc": "Ü¡Ü ÜŸÜ˜Ü¬Ü Ü¡ÜšÜܕܬÜ",
"name:arz": "المملكه المتØده",
"name:ast": "Reinu XunÃu",
"name:az": "Böyük Britaniya",
"name:ba": "Бөйөк БританиÑ",
"name:bar": "Vaeinigts Kinireich",
"name:bat-smg": "Jongtėnė Karalīstė",
"name:bcl": "Reyno Unido",
"name:be": "Ð’ÑлікабрытаніÑ",
"name:be-x-old": "Ð’ÑлікабрытаніÑ",
"name:bg": "Обединено кралÑтво Ð’ÐµÐ»Ð¸ÐºÐ¾Ð±Ñ€Ð¸Ñ‚Ð°Ð½Ð¸Ñ Ð¸ Северна ИрландиÑ",
"name:bi": "Unaeted Kingdom",
"name:bjn": "Britania Raya",
"name:bn": "যà§à¦•à§à¦¤à¦°à¦¾à¦œà§à¦¯",
"name:bo": "དབྱིན་ཇི་མཉམ་འབྲེལà¼",
"name:bpy": "তিলপারাজà§à¦¯",
"name:br": "Rouantelezh-Unanet",
"name:bs": "Ujedinjeno Kraljevstvo Velike Britanije i Sjeverne Irske",
"name:bug": "United Kingdom",
"name:bxr": "ÐÑгдÑÑн Вант УлÑ",
"name:ca": "Regne Unit",
"name:cbk-zam": "Reinos Unidos de Gran Britania y Norte Irelandia",
"name:cdo": "Ĭng-guók",
"name:ce": "Йоккха Британи",
"name:ceb": "Hiniusang Gingharian",
"name:chr": "ᎡᎵáᎯ",
"name:chy": "United Kingdom",
"name:ckb": "شانشینی یەکگرتوو",
"name:co": "Regnu Unitu",
"name:crh": "Büyük Britaniya",
"name:cs": "Spojené královstvÃ",
"name:csb": "Wiôlgô Britanijô",
"name:cu": "Вєлика Британїꙗ",
"name:cv": "ÐÑлă Британи",
"name:cy": "Deyrnas Unedig",
"name:da": "Storbritannien",
"name:de": "Vereinigtes Königreich Großbritannien und Nordirland",
"name:diq": "Qraliya Yewbiyayiye",
"name:dsb": "Wjelika Britaniska",
"name:dv": "Þ”ÞªÞ‚Þ¦Þ‡Þ¨Þ“Þ¬Þ‘Þ° Þ†Þ¨Þ‚Þ°ÞŽÞ°Þ‘Þ¦Þ‰Þ°",
"name:dz": "ཡུ་ནའི་ཊེཊ་ཀིང་ཌམ",
"name:ee": "United Kingdom",
"name:el": "ΗνωμÎνο Βασίλειο",
"name:eml": "Régn Unî",
"name:en": "United Kingdom",
"name:eo": "UnuiÄinta ReÄlando",
"name:es": "Reino Unido",
"name:et": "Suurbritannia",
"name:eu": "Erresuma Batua",
"name:ext": "Réinu Uniu",
"name:fa": "بریتانیا",
"name:fi": "Yhdistynyt kuningaskunta",
"name:fiu-vro": "Ãœtiskuningriik",
"name:fo": "Stóra Bretland",
"name:fr": "Royaume-Uni",
"name:frp": "Royômo-Uni",
"name:frr": "Feriind Kiningrik",
"name:fur": "Ream Unît",
"name:fy": "Grut-Brittanje",
"name:ga": "An RÃocht Aontaithe",
"name:gag": "Büük Britaniya",
"name:gan": "英國",
"name:gd": "An Rìoghachd Aonaichte",
"name:gl": "Reino Unido",
"name:gn": "Tavetã Joaju",
"name:gu": "યà«àª¨àª¾àª‡àªŸà«‡àª¡ કિંગડમ",
"name:gv": "Reeriaght Unnaneysit",
"name:ha": "Birtaniya",
"name:hak": "Yîn-koet",
"name:haw": "Aupuni MÅʻī Hui PÅ« Ê»ia",
"name:he": "הממלכה המ×וחדת",
"name:hi": "यूनाइटेड किंगडम",
"name:hif": "United Kingdom",
"name:hr": "Ujedinjeno Kraljevstvo Velike Britanije i Sjeverne Irske",
"name:hsb": "Zjednoćene kralestwo",
"name:ht": "Wayòm Ini",
"name:hu": "Egyesült Királyság",
"name:hy": "Õ„Õ«Õ¡ÖÕµÕ¡Õ¬ Ô¹Õ¡Õ£Õ¡Õ¾Õ¸Ö€Õ¸Ö‚Õ©ÕµÕ¸Ö‚Õ¶",
"name:ia": "Regno Unite",
"name:id": "Britania Raya",
"name:ie": "Reyatu Unit",
"name:ig": "Obodoézè Nà Ofú",
"name:ilo": "Nagkaykaysa a Pagarian",
"name:io": "Unionita Rejio",
"name:is": "Bretland",
"name:it": "Regno Unito",
"name:ja": "イギリス",
"name:jbo": "gugdegubu",
"name:jv": "Britania Raya",
"name:ka": "გáƒáƒ”რთიáƒáƒœáƒ”ბული სáƒáƒ›áƒ”ფáƒ",
"name:kab": "Legliz",
"name:kbd": "БританиÑшхуÑ",
"name:kg": "Royaume-Uni",
"name:kk": "ҰлыбританиÑ",
"name:kl": "Tuluit Nunaat",
"name:km": "រាជាណាចក្ររួម",
"name:kn": "ಯà³à²¨à³ˆà²Ÿà³†à²¡à³ ಕಿಂಗà³â€Œà²¡à²‚",
"name:ko": "ì˜êµ",
"name:koi": "Ыджыт Бритму",
"name:krc": "Уллу БританиÑ",
"name:ksh": "Jrußbritannie",
"name:ku": "Keyaniya Yekbûyî",
"name:kv": "Ыджыд БританиÑ",
"name:kw": "Ruwvaneth Unys",
"name:ky": "Улуу Ð‘Ñ€Ð¸Ñ‚Ð°Ð½Ð¸Ñ Ð¶Ð°Ð½Ð° Түндүк ИрландиÑ",
"name:la": "Britanniarum Regnum",
"name:lad": "Reyno Unido",
"name:lb": "Groussbritannien an Nordirland",
"name:lez": "ЧIехибританиÑ",
"name:li": "Vereineg Keuninkriek",
"name:lij": "Regno Unïo",
"name:lmo": "Regn Ünì",
"name:ln": "IngÉ›lÉ›ÌtÉ›lÉ›",
"name:lt": "JungtinÄ— KaralystÄ—",
"name:ltg": "Lelbrytaneja",
"name:lv": "ApvienotÄ Karaliste",
"name:mg": "Fanjakana Mitambatra",
"name:mhr": "Ушымо КоролевÑтве",
"name:mi": "KÄ«ngitanga Kotahi",
"name:mk": "Обединето КралÑтво",
"name:ml": "à´¯àµà´£àµˆà´±àµà´±à´¡àµ à´•à´¿à´™àµà´¡à´‚",
"name:mn": "Их Британи",
"name:mr": "यà¥à¤¨à¤¾à¤¯à¤Ÿà¥‡à¤¡ किंगà¥à¤¡à¤®",
"name:mrj": "Кого Британи",
"name:ms": "United Kingdom",
"name:mt": "Renju Unit",
"name:mwl": "Reino Ounido",
"name:my": "ယူနá€á€¯á€€á€ºá€á€€á€ºá€€á€„်းဒမ်းနá€á€¯á€„်ငံ",
"name:mzn": "بریتانیا",
"name:na": "Ingerand",
"name:nah": "TlacetilÄ«lli HuÄ“yitlahtohcÄyÅtl",
"name:nap": "Gran Vretagna",
"name:nds": "Vereenigt Königriek vun Grootbritannien un Noordirland",
"name:nds-nl": "Verienigd Keuninkriek",
"name:ne": "संयà¥à¤•à¥à¤¤ अधिराजà¥à¤¯",
"name:nl": "Verenigd Koninkrijk",
"name:nn": "Storbritannia",
"name:no": "Storbritannia",
"name:nov": "Unionati Regia",
"name:nrm": "Rouoyaume Unni",
"name:nv": "Tótaʼ Dinéʼiʼ Bikéyah",
"name:oc": "Reialme Unit",
"name:or": "ଯàକàତରାଜààŸ",
"name:os": "Стыр Британи",
"name:pa": "ਸੰਯà©à¨•à¨¤ ਬਾਦਸ਼ਾਹੀ",
"name:pag": "Reino Unido",
"name:pam": "Pisanmetung a Ka-arian",
"name:pap": "Reino Uni",
"name:pcd": "Roéyôme-Uni",
"name:pih": "Yunitid Kingdum",
"name:pl": "Wielka Brytania",
"name:pms": "Regn Unì",
"name:pnb": "برطانیÛ",
"name:pnt": "ΗνωμÎνο Βασίλειο",
"name:ps": "بريتانيا",
"name:pt": "Reino Unido",
"name:qu": "Hukllachasqa Qhapaq Suyu",
"name:rm": "Reginavel Unì",
"name:rmy": "Phandlo Thagaripen la Bare Britaniyako thai le Nordutne Irlandesko",
"name:ro": "Regatul Unit al Marii Britanii și al Irlandei de Nord",
"name:roa-rup": "Britania Mari",
"name:roa-tara": "Regne Aunìte",
"name:ru": "ВеликобританиÑ",
"name:rue": "Велика БрітаніÑ",
"name:rw": "Ubwongereza",
"name:sa": "संयà¥à¤•à¥à¤¤ अधिराजà¥à¤¯",
"name:sah": "Холбоhуктаах Хоруоллук",
"name:sc": "Rennu Auniadu",
"name:scn": "Regnu Unitu",
"name:sco": "Unitit Kinrick",
"name:se": "Ovttastuvvan gonagasriika",
"name:sh": "Ujedinjeno Kraljevstvo",
"name:si": "එක්සà¶à·Š රà·à¶¢à¶°à·à¶±à·’ය",
"name:simple": "United Kingdom",
"name:sk": "Spojené kráľovstvo",
"name:sl": "Združeno kraljestvo Velike Britanije in Severne Irske",
"name:sn": "United Kingdom",
"name:so": "Midowga boqortooyada Britan",
"name:sq": "Mbretëria e Bashkuar e Britanisë dhe Irlandës së Veriut",
"name:sr": "Уједињено КраљевÑтво",
"name:srn": "Ingriskondre",
"name:ss": "United Kingdom",
"name:stq": "Fereeniged Köönichriek fon Groot-Britannien un Noudirlound",
"name:su": "Britania",
"name:sv": "Storbritannien",
"name:sw": "Ufalme wa Muungano",
"name:szl": "Wjelgo Brytańijo",
"name:ta": "à®à®•à¯à®•à®¿à®¯ இராசà¯à®šà®¿à®¯à®®à¯",
"name:te": "à°¯à±à°¨à±ˆà°Ÿà±†à°¡à± à°•à°¿à°‚à°—à±â€Œà°¡à°®à±",
"name:tet": "Reinu Naklibur",
"name:tg": "Подшоҳии Муттаҳида",
"name:th": "สหราชà¸à¸²à¸“าจัà¸à¸£",
"name:tl": "Nagkakaisang Kaharian",
"name:tpi": "Yunaitet Kingdom",
"name:tr": "Birleşik Krallık",
"name:tt": "БөекбританиÑ",
"name:tw": "United Kingdom",
"name:ty": "ParatÄne",
"name:udm": "ВеликобританиÑ",
"name:ug": "بۈيۈك بÛرىتانىيە",
"name:uk": "Велика БританіÑ",
"name:ur": "برطانیÛ",
"name:uz": "Birlashgan Qirollik",
"name:vec": "Regno Unìo",
"name:vep": "Sur' Britanii",
"name:vi": "Vương quốc Anh",
"name:vls": "Verênigd Keunienkryk",
"name:vo": "Regän Pebalöl",
"name:war": "Reino Unido",
"name:wo": "Nguur-Yu-Bennoo",
"name:wuu": "英国",
"name:xal": "Ик Бритишин болн ÐÑ€ Гәәлгүдин Ðиицәтә Ðутг",
"name:xmf": "გáƒáƒáƒ თáƒáƒ˜áƒáƒœáƒáƒ¤áƒ˜áƒšáƒ˜ áƒáƒ›áƒáƒ¤áƒ”",
"name:yi": "פ×ר××™×™× ×™×’×˜×¢ ×§×¢× ×™×’×¨×™×™×š",
"name:yo": "Ilẹ̀á»ba Aá¹£á»Ì€kan",
"name:za": "Yinghgoz",
"name:zea": "Vereênigd Konienkriek",
"name:zh": "英国",
"name:zh-classical": "英國",
"name:zh-min-nan": "Liân-haÌp Ông-kok",
"name:zh-simplified": "英国",
"name:zh-traditional": "英國",
"name:zh-yue": "英國",
"name:zu": "Umbuso Ohlangeneyo",
"native_name": "United Kingdom of Great Britain and Northern Ireland",
"native_name:da": "Det Forenede Kongerige Storbritannien og Nordirland",
"native_name:es": "Reino Unido de Gran Bretaña e Irlanda del Norte",
"native_name:vi": "Vương quốc Liên hiệp Anh và Bắc Ireland",
"official_name:en": "United Kingdom of Great Britain and Northern Ireland",
"official_name:it": "Regno Unito di Gran Bretagna e Irlanda del Nord",
"timezone": "Europe/London",
"type": "boundary",
"wikidata": "Q145",
"wikipedia": "en:United Kingdom"
}
}
,
{
"type": "area",
"id": 3600129306,
"tags": {
"admin_level": "8",
"boundary": "administrative",
"designation": "non_metropolitan_district",
"name": "New Forest",
"population": "174309",
"ref:gss": "E07000091",
"ref:lau:1": "UKJ3308",
"source:ref:gss": "OS_OpenData_Boundary-Line",
"source:ref:lau": "ONS_OpenData",
"type": "boundary",
"website": "http://www.newforest.gov.uk/",
"wikipedia": "en:New Forest District"
}
}
,
{
"type": "area",
"id": 3600151304,
"tags": {
"admin_level": "5",
"boundary": "administrative",
"name": "South East England",
"name:de": "Südostengland",
"name:en": "South East England",
"ref:gss": "E12000008",
"ref:nuts:1": "UKJ",
"source:ref:gss": "ONS_OpenData",
"type": "boundary",
"wikipedia": "en:South East England"
}
}
,
{
"type": "area",
"id": 3600172799,
"tags": {
"admin_level": "6",
"boundary": "administrative",
"designation": "non_metropolitan_county",
"name": "Hampshire",
"note": "Inner ring is to seperate Hampshire from Southampton which is a UA",
"population": "1304844",
"ref:gss": "E10000014",
"ref:nuts:3": "UKJ33",
"source:ref:gss": "OS_OpenData_Boundary-Line",
"source:ref:nuts": "ONS_OpenData",
"type": "boundary",
"website": "http://www.hampshire.gov.uk/",
"wikipedia": "en:Hampshire"
}
}
,
{
"type": "area",
"id": 3602698314,
"tags": {
"boundary": "ceremonial",
"name": "Hampshire",
"note": "Ceremonial County, including Portsmouth and Southampton",
"type": "boundary"
}
}
,
{
"type": "area",
"id": 3603746024,
"tags": {
"boundary": "statistical",
"name": "Hampshire and Isle of Wight",
"ref:nuts:2": "UKJ3",
"source": "ONS_OpenData",
"type": "boundary",
"wikipedia": "en:NUTS of the United Kingdom"
}
}
]
}
And from this is I can use code to go through the boundary admin_levels, in descending sequence, to give me:
New Forest, Hampshire, South East England, England, United Kingdom
which are exactly the details I was hoping to get from the is_in tag. So, I've started a process of doing this for all of the towns and cities, effectively adding my own 'is_in' tag to my application's database.
Here's some results from the process, with the node's is_in tag at the end (if it has one) to allows some comparison. The number at the beginning is the node's id for reference, e.g. http://www.openstreetmap.org/node/107775 for the first row.
107775 - London: Greater London, England, United Kingdom [is_in=England, United Kingdom, UK, Great Britain, Europe]
204648 - Wellington: New Zealand [is_in=North Island, New Zealand]
273316 - Itajaí: Santa Catarina, South Region, Brazil [is_in=Santa Catarina, Brazil]
358309 - Leeds: Yorkshire and the Humber, England, United Kingdom [is_in=UK,United Kingdom, Yorkshire,West Yorkshire, Airedale]
441183 - Athens: Central section of Athens, Attica Periphery, Greece [is_in=Athina municipality,Attiki,Greece,EU]
671113 - Baltimore: Maryland, United States of America
1947201 - Bath: Bath & North East Somerset, South West England, United Kingdom [is_in=Somerset, England, UK]
3216768 - St David's: Pembrokeshire, Wales, United Kingdom [is_in=Wales]
6968827 - Ljubljana: Osrednjeslovenska, Western Slovenia [is_in=Slovenia, Europe]
8087537 - Chester: Cheshire West and Chester, North West England, United Kingdom
9002746 - Charleroi: Hainaut, Wallonia (French Community), Belgium [is_in=Hainaut; Wallonie; Belgique; Europe]
9331795 - Limassol: Cyprus [is_in=Cyprus]
10021976 - Leicester: East Midlands, England, United Kingdom [is_in=Leicestershire, England, UK]
10671639 - Lincoln: Lincolnshire, East Midlands, England, United Kingdom
11094836 - Nyköping: Södermanlands län, Svealand, Sweden [is_in=Nyköping, Södermanland, Sweden, EU]
11127374 - Glasgow: Glasgow City, Scotland, United Kingdom [is_in=Scotland, UK]
11235057 - Norwich: Norfolk, East of England, United Kingdom [is_in=England, Norfolk]
12805909 - Oxford: Oxfordshire, South East England, United Kingdom [is_in=Oxfordshire, England, UK]
13707878 - Copenhagen: Capital Region of Denmark [is_in=Hovedstaden, Denmark, EU]
13766899 - Sydney: New South Wales, Australia
14446670 - Quezon City: Metro Manila, Philippines [is_in=Metro Manila]
14644309 - Iskenderun: Hatay, Mediterranean Region, Turkey [is_in=Turkey, Antakya]
15412058 - Helsingborg: Skåne län, Götaland, Sweden [is_in=Helsingborgs kommun, Skåne, Skåne län, Sweden]
16173235 - Mumbai: Maharashtra, India
16173236 - New Delhi: Delhi, India [is_in=National Capital Region, NCR, India]
16174445 - Pune: Maharashtra, India [is_in=India]
16175031 - Islamabad: Islamabad Capital Territory, Pakistan [is_in=Pakistan, Asia]
16175073 - Lahore: Punjab, Pakistan [is_in=Pakistan]
17193023 - Erlangen: Middle Franconia, Free State of Bavaria, Germany [is_in=Mittelfranken,Bayern,Bundesrepublik Deutschland,Europe]
17328659 - Vienna: Austria [is_in=Österreich,Europe]
17550787 - Pécs: Baranya megye, Southern Transdanubia, Hungary [is_in=Pécsi kistérség; Baranya megye; Dél-Dunántúl; Magyarország]
17721995 - Portsmouth: South East England, United Kingdom [is_in=Hampshire, England, UK]
17807753 - Paris: Ile-de-France, Metropolitan France
17857512 - Gloucester: Gloucestershire, South West England, United Kingdom [is_in=England, Gloucestershire]
17859918 - Coventry: West Midlands, England, United Kingdom
17861291 - Birmingham: West Midlands, England, United Kingdom [is_in=West Midlands, England, United Kingdom]
17898859 - Edinburgh: City of Edinburgh, Scotland, United Kingdom [is_in=Scotland, United Kingdom, UK, Great Britain, Europe]
17916174 - Canterbury: Kent, South East England, United Kingdom [is_in=Kent, England, UK]
17951258 - Peterborough: East of England, United Kingdom
17986274 - Plymouth: South West England, United Kingdom [is_in=Devon, England, UK]
18009959 - Exeter: Devon, South West England, United Kingdom [is_in=Devon, England, UK]
18063533 - Toronto: Ontario, Canada [is_in=Ontario, Canada]
18318938 - Hildesheim: Landkreis Hildesheim, Lower Saxony, Germany [is_in=Hildesheim,Niedersachsen,Bundesrepublik Deutschland,Europe]
18477455 - Bern: Verwaltungskreis Bern-Mittelland, Verwaltungsregion Bern-Mittelland, Switzerland [is_in=Bern-Mittelland,Schweiz,CH,Europe]
18886011 - Ottawa: Ontario, Canada [is_in=Ontario, Canada]
So, my reason for posting this is that this raises some questions:
- Can my processing be improved? Should I look at Overpass areas other than the ones with a boundary and admin_level tag, perhaps? How would I determine the right sort sequence when I don't have an admin_level?
- Should I consider sharing the results of my processing? Should I even consider using this to update the OSM central database, setting each place node with the is_in tags I have determined? I would have used a more standardised is_in tag if it had been available and so wonder if the OSM community could benefit somehow?
- I'm really only considering English names, but am aware I'm working with Worldwide data. If this information is to be shared what additional processing should be added? I wonder if I can determine the language which is applicable to each node so I could use, for example, the name:es tags for a Spanish location rather than the name:en ones which I'm using currently?
One thing nagging me is that I'm wondering why this approach hasn't been applied before. Map data is, by its very nature, a hierarchy of places within other places, so why is it necessary to have a free-form is_in tag to describe the hierarchy which already exists? I've read through http://wiki.openstreetmap.org/wiki/Key:is_in and the discussion about boundary polygon making is_in redundant vs. is_in permitting 'simpler searching and easy disambiguation' and I strongly agree with the latter point; in my case having the is_in tag available would save a great deal of complex boundary processing by the Overpass API servers.
Thanks for any help or guidance you can offer.
Please don't ask multiple questions at once. You already seem to have noted that the use of the is_in tag is discouraged. It might be easier to process, but it is difficult to keep all the is_in tags including their full hierarchy up-to-date. Boundary polygons provide much more exact borders and are easier to maintain in the long run.
Sorry, but it's difficult to avoid asking multiple questions when they relate to the same point.
I'm suggesting that if the is_in tag was set from the boundary polygons, then you avoid the need to do all that boundary processing in cases such as the one discussed in my question. If I have a planet file and an extract of the nodes representing the towns and cities I need to display, how should I determine the location name hierarchy? I think Nominatim is overkill for what I need. To ask a single question: I've found a way to achieve my requirements, is there a better approach though?