The Virtual Earth Platform contains actually 2 services. Virtual Earth (VE) itself and the MapPoint Web Service (MWS). As a customer you have access to both services and if you just want to evaluate the MapPoint Web Service you can request an evaluation-account here.
While Virtual Earth is implemented through an AJAX-control you can access the MapPoint Web Service through a SOAP-API. In general there are not many reasons why you would want to use MapPoint Web Service in the presentation layer. One of the exceptions might be the LineDrive map-style for driving directions which removes the complexity of the map and shows just the relevant pieces of the route.
However, in the business layer and the backend MapPoint Web Service has still a few advantages such as:
- batch geocoding,
- reverse geocoding and
- a point of interest database.
While Virtual Earth has business listings available in some countries, MapPoint Web Service has point of interest databases for the North American and the European market. These POI data sources are organized hierarchically, e.g.:
If you are interested for example in airports you can distinguish between minor airfields and major airports or you can get them all with one call. To do so you determine the Entity-name in the POI-table which is linked above, e.g. SIC4581 for major airports, SIC4580 for airfields or SICMaj45 if you want them all. Even when you get them all you can retrieve the Entity-Type from the results to set different icons (e.g. myResults.Results(j).FoundLocation.Entity.TypeName).
The limitation is that the search-radius may not be bigger than 400 km or 250 miles. Additionally you have to consider that MWS uses a search-radius while Virtual Earth (VE) has a rectangle mapview. To determine the search-radius you can retrieve the latitude and longitude from the upper-left corner and the centre-point in VE and pass them as parameter through an AJAX-call to a web handler which in turn calls MWS. In MWS we have a function which allows you to calculate distances between 2 or more pairs of latitudes and longitudes.
Lets have a look at the process:
- When the user opens the page in his browser
- He retrieves the website itself from your server (1a) …
- …and since you reference the Virtual Earth MapControl in the head of the HTML-document, it retrieves the MapControl and the tiles directly from the Microsoft data centres (1b).
- If you want to display the a POI-category you execute an AJAX-call to a web handler or web service on your web server. As parameters we send the latitude and longitudes of the upper-left corner and the centre-point of the map…
Below you will find a sample application.
This application uses a couple of your categories and adjusts the search-result whenever you pan or zoom the map.
If you haven’t done so yet, you need to request a MWS developer account. To do so you will need a Windows Live ID. This account can later be converted into a production account. Once you have the credentials enter them in the web handler CallMWS.ashx
'Set up the web service Dim myCredentials As New NetworkCredential("YOUR ID", "YOUR PWD")