0

I am working with the Reverse Geocoding feature available with the Here maps.

The code: var geocoder = platform.getGeocodingService(), reverseGeocodingParameters = { prox: 32.2960,77.1896,150, mode: 'retrieveAddresses', maxresults: '1', jsonattributes : 1

Also retrieveAreas is also not working properly };

If we zoom out(scale 2km), then we can see the name of places like Kulang, Kaushala, Dharanu, etc. I want to display these names of places in the alert box.

Can anypne please look in this and guide me accordingly

If I use address.district then it just says a sub-district/undefined but does not signify the name.

NehaK
  • 1
  • 1

1 Answers1

0

Data returned from reverse geocoder api is structured according to the reliable source data provided from that region. You need not necessarily find all info like county, district etc for a particular address(for example built-up is a division in European countries but it is not relevant to some Asian countries). Also eventhough the mode=retrieveAddresses is provided there is no guarantee you will find an address for the lat,long within the radius you provided(houseNumber- address match). In such cases the api returns automatically the next possible match level data(in your case the response provides match level-street). For that match level, the info provided by the api is correct and you can view the same data in the Here Wego map as well.

You can increases maxresults attribute count to see more than 1 result and display them in the alert box. I would suggest to individually query the api first before embedding them into the JS.

Hope this helps!

https://reverse.geocoder.api.here.com/6.2/reversegeocode.json?xnlp=CL_JSMv3.0.17.0&app_id=xxxx&app_code=yyyy&prox=32.2960,77.1896,1500&mode=retrieveAddresses&maxresults=1&jsonattributes=1

Part of the response: {label": "Manali Sub-District 175103, India", "country": "IND", "state": "HP", "county": "Kullu", "city": "Manali Sub-District", "postalCode": "175103" }

enter image description here