1
votes

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

1
What parameter are you passing in that returns a full postal code? What parameter are you passing in that returns a partial postal code? - mjwills
as I said, I am using a pushPin on a bin map wich contains a (x,y) point. by using reverse geocoding, the (x,y) return a full postal code and sometimes a partial postal code - AntoOne

1 Answers

0
votes

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