js-reverse-geocode-client
js-reverse-geocode-client copied to clipboard
Only Known Long/Lat reverse code working
Hi There,
I tried to get the location ref. using the published code and using bigdatacloud_reverse_geocode.min.js
<script>
/* Initialise Reverse Geocode API Client */
var reverseGeocoder = new BDCReverseGeocode();
/* Get the current user's location information, based on the coordinates provided by their browser */
/* Fetching coordinates requires the user to be accessing your page over HTTPS and to allow the location prompt. */
reverseGeocoder.getClientLocation(function(result) {
document.getElementById("json-result").innerHTML = rresult.localityInfo['administrative'][4].name;
});
/* Get the administrative location information using a set of known coordinates */
reverseGeocoder.getClientLocation({
latitude: 12.9716,
longitude: 77.5946,
}, function(result) {
document.getElementById("json-result").innerHTML = result.localityInfo['administrative'][4].name;
});
/* You can also set the locality language as needed */
reverseGeocoder.localityLanguage = 'en';
/* Request the current user's coordinates (requires HTTPS and acceptance of prompt) */
reverseGeocoder.getClientCoordinates(function(result) {
document.getElementById("json-result").innerHTML = result.localityInfo['administrative'][4].name;
});
/* document.getElementById("log").innerHTML = 5 + 6;*/
</script>
This returns 'Bengaluru' which is correct.
But, during my testing (and located in New Delhi), it does not work even after 'accepting' the location permissions.
Could you check, to view please visit Incidental app and you could see the location below the yellow divider.

Thanks.