|Executive Summary: Check out a custom .NET Windows application that takes advantage of MapPoint Web Service geocoding to fix a problem with longitude/latitude values in AdventureWorks2008.|
In “Integrating SQL Server 2008 Spatial Capabilities with Microsoft Virtual Earth,” InstantDoc ID 100528, I show you how spatial data (store locations from the new AdventureWorks2008 database) can be displayed on a Virtual Earth map. Many of the store addresses in the database contain valid street, city, state, and postal code values. However, some of the stores' longitude/latitude values (which are stored in the SpatialLocation geography column of the Address table) are slightly inaccurate.
To fix this problem, I’ve built a .NET Windows application (SQLSpatialFixer.vbproj) that uses the MapPoint Web Service (www.microsoft.com/mappoint/products/webservice/default.mspx) geocoding. To download the SQLSpatilaFixer.exe, enter 100528 in the InstantDoc ID text box and click the 100528.zip hotlink. Running this sample requires a username and password for the MapPoint Web Service. You can learn more about obtaining a Virtual Earth Platform Developer Account at https://mappoint-css.live.com/mwssignup.
Geocoding is a term for assigning geographic identifiers (in this case, a longitude/latitude coordinate) to an entity (e.g., a store address). Figure A shows the application's main form. At the top of the form, you select a US state, and then click Load to populate the ListView with a list of stores. You can double-click a row in the list view to see the closest matched address, along with the Original Address as defined by the database longitude/latitude coordinate. Figure B shows an example of an address in Arizona that shows up several miles southwest of where it should be.
Finally, you can click Update to update the longitude/latitude values. The application iterates through each row in the list view and calls the MapPoint Web Service to return the longitude/latitude of the closest matched address. Then, if the longitude/latitude value doesn’t match what’s in the database, the application updates the database record.