Geocoder icon indicating copy to clipboard operation
Geocoder copied to clipboard

open-cage-provider issue with adminLevels

Open amaneshi opened this issue 5 years ago • 3 comments

In some cases provider don't return any adminLevels (empty list), but they should be there. As example, if we try to reverse point (47.571109, 19.108676) we get address "Budapest, Pajtás utca 2, 1046, Hungary" without admin levels in parsed object. But in original JSON response we have component item: "region": "Central Hungary" As I think, Regions should be admin level = 1.

amaneshi avatar Jan 21 '20 16:01 amaneshi

Looking at the code, currently state is admin level one, and country is admin level two.

Can you post the full json response please?

atymic avatar Jan 21 '20 22:01 atymic

Yes, I saw that two level in sources, but in my response there is none of them so temporary I add another case with "region". Full response too long to post here, if you want get it grab coordinates from first message and use it on OpenCage live demo page https://opencagedata.com/demo. Here is only components section of it (point of interest):

"components": {
        "ISO_3166-1_alpha-2": "HU",
        "ISO_3166-1_alpha-3": "HUN",
        "_category": "building",
        "_type": "building",
        "city": "Budapest",
        "city_district": "4th district",
        "continent": "Europe",
        "country": "Hungary",
        "country_code": "hu",
        "house_number": "2",
        "neighbourhood": "Szilaspatak-lakópark",
        "political_union": "European Union",
        "postcode": "1046",
        "region": "Central Hungary",
        "road": "Pajtás utca",
        "suburb": "Megyer"
      },

amaneshi avatar Jan 22 '20 08:01 amaneshi

Yeah, I think we really need to normalize our admin levels ! There is a discussion about it in my issue #852 (I still need to take care of it).

It was decided to have admin level 1 as "first-order civil entity below the country level". So I think we should indeed fix the parseAdminsLevels() function in OpenCage provider !

Looking at an address in Belgium, I would say:

  1. state
  2. county (not country)
  3. town
  4. village

But there is not region in Belgian addresses in OpenCage apparently, so I don't know where to put it :P

jbelien avatar Jan 22 '20 08:01 jbelien