open-cage-provider issue with adminLevels
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.
Looking at the code, currently state is admin level one, and country is admin level two.
Can you post the full json response please?
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"
},
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:
statecounty(notcountry)townvillage
But there is not region in Belgian addresses in OpenCage apparently, so I don't know where to put it :P