I am using Bing map to get the postal code from a pin location. With this code, sometimes I am getting a full postal code (eg. G0L 4K0) and sometimes I receive a partial postal code (eg. G0L).
function reverseGeocode(pin) {
var pinLocation = new Microsoft.Maps.Location(pin.geometry.y, pin.geometry.x);
console.log(pinLocation);
var searchRequest = {
location: pinLocation,
callback: function (r) {
console.log(r);
postalCodeStart = r;
},
errorCallback: function (e) {
}
};
searchManager.reverseGeocode(searchRequest);
}
by example, with this url : "http://dev.virtualearth.net/REST/v1/Locations/45.5124,-73.5547?o=json&key=myKey", I get "postalCode":"H2L"
I really need to receive the full postal code, how can I get it?
Thanks in advance
Finally I found that Bing map's api is not always perfect while using its reverse geocoding (i found many questions related to my issue on internet)
https://nominatim.openstreetmap.org/reverse.php?format=html seems to have a morre complete api while you need to use reverse geocoding