How do I define the response match level to prevent a street level search

Clash Royale CLAN TAG#URR8PPP
How do I define the response match level to prevent a street level search
I am trying to geotag a number of Mexican towns/suburbs using the town/suburb name, the district, and the suburb. that is all i have available to me.
an example of this is:
El Pentagono,Tamaulipas,Aldama
(town) (state) (district)
This winds up as the following query:
https://geocoder.api.here.com/6.2/geocode.json?gen=9&jsonattributes=1&app_code=[app_code]&app_id=[app_id]&country=MX&responseattributes=parsedRequest&searchtext=El Pentagono,Tamaulipas,Aldama
which returns a street level match...
(edited highlights)
"relevance": 1,
"matchLevel": "street",
"matchQuality": {
"country": 1,
"state": 1,
"city": 1,
"street": [0.9]
"address": {
"label": "Carretera a El Pentagono, 89670 Aldama, TAMPS, México",
"country": "MEX",
"state": "TAMPS",
"city": "Aldama",
"street": "Carretera a El Pentagono",
"postalCode": "89670",
so it has matched on a street, rather than the town/suburb of El Pentagono. So how do I tell the API... "no way Jose, give me a town/suburb on El Pentagono, and leave it at that. Don't go looking at streets".
Any help/advice would be awesome
1 Answer
1
One possibility to get the admin hierarchy for a location is to call the Reverse Geocoder with mode=retrieveAreas by using the coordinates you got from the Forward Geocoder response.
mode=retrieveAreas
retrieveAreas - Retrieve the administrative area information for the
position provided in the request
See https://developer.here.com/documentation/geocoder/topics/resource-reverse-geocode.html for details.
Oh hang on... i just reread your response... As you can see in my original post above, my query contains the town, state and area. (El Pentagono,Tamaulipas,Aldama). So i already have the administrative areas. admin1 and admin2. The response is returning El Pentagono street in Aldama. I need the centroid for El Pentagono (the suburb). So i need the API to stop at the town/district level. The lat long for Carretera a El Pentagono (El Pentagono) is different to the lat long for El Pentagono. I can provide further examples if need be.
– Big.Kahuna.Burger
Aug 19 at 10:43
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Theoretically, that might work. but where the town returned on the forward lookup is incorrect (ie: the API has returned a street name match in a different town or a different state), then the lat/long will be wrong, and the reverse lookup will return the incorrect state. I am looking to do this for approximately 85,000 locations, so its unlikely such errors will be picked up easily, and will corrupt our final dataset.
– Big.Kahuna.Burger
Aug 19 at 10:32