locked
Geocoding and Reverse Geocoding result varies RRS feed

  • Question

  • Hi,

    I'm using Bing Map search to find the location by address, by setting "where" parameter. It returns more than one responses. I'm using the 1st response since that is the one which has matchConfidence "high/medium" compared to others. Then I'm using the location returned in that response to Reverse geocode to find the accuracy. But the address returned is completely different. Also,I noticed that, location by address response has addressLine, locality undefined which means that it is not able to identify these data from the address(all data in a single line) I passed to the "where" parameter.

    I found the another way by using Bing Map Location API and explicitly setting the address parameters like below.

    http://dev.virtualearth.net/REST/v1/Locations/?addressLine=1stStreet&countryRegion=AU&adminDistrict=WA&key=BingMapsKey

     But calling to this api returns status 200. But error function is called and the error result is given in the screenshot below.

    am I using the correct URL?

    Also, kindly suggest what is the best way to form search query to get the accurate result?

    Thanks,

    Nithya

    Thursday, February 8, 2018 10:06 AM

Answers

  • Looks like you have a few issues.

    1) Forward and Reverse geocoding results often won't align. This is normal and due to how geocoders typically work. When forward geocoding an address, the street will be found and the location is determined by taking the address number and interpolating its position based on the known street numbers at the intersections of that street. This works well and is how geocoding works in most countries, however, this also means that even if a house number doesn't exist, it will still approximate its location.  When reverse geocoding, it will look for the closest known address that is within 150 meters of the provided coordinate If a street address isn't found it moves up the hierarchy to the closest street within 150 meters, and then postal code, then city and so on until it finds a result. If you provide the input address you are using we can get a better understanding of what is happening. 

    2) The REST URL you provided is not correct and thus why it is erroring. When using individual address parts (not recommended), you shouldn't have a "/" after "Locations". Also, there should be a space between "1st" and "street", use "%20" which is an encoded space character to keep your URL valid. This is documented in the best practices here: https://msdn.microsoft.com/en-us/library/dn894107.aspx That said, if you are developing in JavaScript, use the Search module in the Bing Maps V8 map control, it implements all the best practices for you. If using .NET, consisder using the Bing Maps .NET REST toolkit: https://github.com/Microsoft/BingMapsRESTToolkit

    3) The best way to form your search query is as a single query value (i.e. "1st street, WA, AU"). The geocoder will then parse this and usually better understands the query than if you where to provide it as individual parts (I know this sounds counter intuitive, but there are a lot of different address parts that are not exposed in the REST API, such as county). When passing any address information into a REST URL, you should encode it to ensure that special characters will not cause issues in your request.


    [Blog] [twitter] [LinkedIn]

    Thursday, February 8, 2018 4:35 PM
  • I've never seen "/" in an address before. I've tried the address you provided with a bunch of mapping services besides Bing Maps and none of them were able to geocode it either. India is not well covered by maps yet in majority of mapping platforms as there is a bunch of restrictions and regulations around mapping data in India which prevented a lot of companies from collecting mapping data until recently. there is still a lot of restrictions and regulations but large mapping companies are now starting to be allowed to collect map data. 

    That said, I also tested your location against MapMyIndia who has one of the most complete mapping data sets of India and it didn't understand your address either.

    When Bing Maps can't find an exact address it goes up the hierarchy and tries to find the street, postal code, then city, then state, then country and will return the best result it can. In this case the best it can understand from your input is the city.


    [Blog] [twitter] [LinkedIn]


    Friday, February 9, 2018 4:06 PM

All replies

  • Looks like you have a few issues.

    1) Forward and Reverse geocoding results often won't align. This is normal and due to how geocoders typically work. When forward geocoding an address, the street will be found and the location is determined by taking the address number and interpolating its position based on the known street numbers at the intersections of that street. This works well and is how geocoding works in most countries, however, this also means that even if a house number doesn't exist, it will still approximate its location.  When reverse geocoding, it will look for the closest known address that is within 150 meters of the provided coordinate If a street address isn't found it moves up the hierarchy to the closest street within 150 meters, and then postal code, then city and so on until it finds a result. If you provide the input address you are using we can get a better understanding of what is happening. 

    2) The REST URL you provided is not correct and thus why it is erroring. When using individual address parts (not recommended), you shouldn't have a "/" after "Locations". Also, there should be a space between "1st" and "street", use "%20" which is an encoded space character to keep your URL valid. This is documented in the best practices here: https://msdn.microsoft.com/en-us/library/dn894107.aspx That said, if you are developing in JavaScript, use the Search module in the Bing Maps V8 map control, it implements all the best practices for you. If using .NET, consisder using the Bing Maps .NET REST toolkit: https://github.com/Microsoft/BingMapsRESTToolkit

    3) The best way to form your search query is as a single query value (i.e. "1st street, WA, AU"). The geocoder will then parse this and usually better understands the query than if you where to provide it as individual parts (I know this sounds counter intuitive, but there are a lot of different address parts that are not exposed in the REST API, such as county). When passing any address information into a REST URL, you should encode it to ensure that special characters will not cause issues in your request.


    [Blog] [twitter] [LinkedIn]

    Thursday, February 8, 2018 4:35 PM
  • Thanks for the detailed explanation!

    1) The search query I'm passing to SearchModule is

    8/37/4, Kasthuribai street,Ammapalayam,Tamilnadu,641652,India.

    Below is the response screenshot.

    In the response, under 1st result address, addressLine and postalAddress are undefined. Can you guide me to format the address so that it understands addressLine and postalAddress as well.

    Below is the details of the address FY understanding.

    Street: 8/37/4, Kasthuribai street

    City:Ammapalayam

    State:Tamilnadu

    Postal Code: 641652

    Country: India

    2) Initially I used the rest service url without '/ ' after location, like

    http://dev.virtualearth.net/REST/v1/Locations?addressLine=1stStreet&countryRegion=AU&adminDistrict=WA&key=BingMapsKey

    But I got a response with status code "301 permanently moved" and location header in the response set to below

    http://dev.virtualearth.net/REST/v1/Locations/?addressLine=1stStreet&countryRegion=AU&adminDistrict=WA&key=BingMapsKey

    Thanks,

    Nithya



    Friday, February 9, 2018 9:45 AM
  • I've never seen "/" in an address before. I've tried the address you provided with a bunch of mapping services besides Bing Maps and none of them were able to geocode it either. India is not well covered by maps yet in majority of mapping platforms as there is a bunch of restrictions and regulations around mapping data in India which prevented a lot of companies from collecting mapping data until recently. there is still a lot of restrictions and regulations but large mapping companies are now starting to be allowed to collect map data. 

    That said, I also tested your location against MapMyIndia who has one of the most complete mapping data sets of India and it didn't understand your address either.

    When Bing Maps can't find an exact address it goes up the hierarchy and tries to find the street, postal code, then city, then state, then country and will return the best result it can. In this case the best it can understand from your input is the city.


    [Blog] [twitter] [LinkedIn]


    Friday, February 9, 2018 4:06 PM