Geocoding with Dynamics

I’ve been working on a few projects the last little while that has involved leveraging Geocoding services to augment address data stored in Dynamics.  Where I previously thought that all Geocoding services are created equal, I was quick to learn that they are not and you should definitely do your due diligence in looking into what service you use.

This is an important piece as well, we were focused on using services only and not buying data that needed to be updated every quarter.  Many of the services out there give you a free stack of geocoding requests (based on what you’re doing) that you can most likely throttle down your daily limits and/or take the hit on.

What I found most interesting was to see which platforms had access to which data.  One provider we were looking at has a fantastic API but their data had not kept up with an amalgamation of cities and did not return Canadian postal codes which made it quite problematic to use.

In the end, we settled on Bing and the API itself could not be easier to use.  Before you even start coding, you can do it all via your web-browser.

Here is how you do it, you take this URL, you add in your API key that you get from the Bing Developer Portal and then format it as follows;

http://dev.virtualearth.net/REST/v1/Locations?key={0}&q={1}

With my key, I tried doing a search for 1 Toronto Place, Toronto, Ontario Canada and here are the results.

{"authenticationResultCode":"ValidCredentials","brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png","copyright":"Copyright © 2019 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.","resourceSets":[{"estimatedTotal":2,"resources":[{"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1","bbox":[43.6488458,-79.3771936,43.6510942,-79.3740864],"name":"1 Toronto St, Toronto, ON M5C 2V6, Canada","point":{"type":"Point","coordinates":[43.64997,-79.37564]},"address":{"addressLine":"1 Toronto St","adminDistrict":"ON","adminDistrict2":"Toronto","countryRegion":"Canada","formattedAddress":"1 Toronto St, Toronto, ON M5C 2V6, Canada","locality":"Toronto","postalCode":"M5C 2V6"},"confidence":"Medium","entityType":"Address","geocodePoints":[{"type":"Point","coordinates":[43.64997,-79.37564],"calculationMethod":"Rooftop","usageTypes":["Display"]},{"type":"Point","coordinates":[43.64988,-79.37607],"calculationMethod":"Rooftop","usageTypes":["Route"]}],"matchCodes":["Ambiguous"]},{"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1","bbox":[43.6689718,-79.4682881,43.6712201,-79.4651798],"name":"1 W Toronto St, Toronto, ON M6N, Canada","point":{"type":"Point","coordinates":[43.6700959,-79.466734]},"address":{"addressLine":"1 W Toronto St","adminDistrict":"ON","adminDistrict2":"Toronto","countryRegion":"Canada","formattedAddress":"1 W Toronto St, Toronto, ON M6N, Canada","locality":"Toronto","postalCode":"M6N"},"confidence":"Medium","entityType":"Address","geocodePoints":[{"type":"Point","coordinates":[43.6700959,-79.466734],"calculationMethod":"Interpolation","usageTypes":["Display"]},{"type":"Point","coordinates":[43.6699625,-79.4667067],"calculationMethod":"Interpolation","usageTypes":["Route"]}],"matchCodes":["Ambiguous"]}]}],"statusCode":200,"statusDescription":"OK","traceId":"c85baa1be6a94dcbb92350fe8c070057|BN000021CB|7.7.0.0|Ref A: C35EE63A372944B78EBD369172B283AF Ref B: BN3EDGE0220 Ref C: 2019-08-13T23:42:04Z"}





Code could not get any simpler.

What I found really interesting about looking at the data is what comes back.  Without asking for postal code I get it back and I also received confidence scores along with proximity to placement. (i.e. rooftop or place).

Using the below table, results that are listed at the top have the highest degree of accuracy and those at the bottom are better left not to report.

Result Description
rooftop The exact point was found with rooftop level accuracy
point

 

The exact point was found from address range interpolation where the range contained a single point
range_interpolation

 

The point was found by performing address range interpolation
nearest_rooftop_match

 

The exact house number was not found, so a close, neighboring house number was used instead
intersection

 

The result is an intersection between two streets
street_center

 

The result is a geocoded street centroid
place

 

The point is a city/town/place
state

 

The point is a state

Now that I have all this information, what am I going to do with it?

Post A Reply

%d bloggers like this: