Introduction

The MapPoint technology by Microsoft provides a programmable web service, used by enterprises and independent software developers to integrate location-based services such as maps, driving directions and proximity searches into software applications and business processes.

MapPoint web services API

MapPoint web service is an XML web service with a SOAP API that is comprised of four constituent services: finding locations, creating routes, rendering maps, and a set of utility function objects and methods that are common to the previous three. To call the service in your application, you need to reference the MapPoint Web Service Description Language (WSDL).

Registering for MapPoint developer account

Before you start development with the MapPoint web service API, you need to register for a MapPoint Web Service Developer trial account with Microsoft from this URL.

Once you apply for registration, you get an email from Microsoft saying that they would process your application and activate your trial account within 1-2 business days. Once your account gets approved, you will have access to the 'Extranet portal site' and the 'MapPoint Web Service Customer Services site' and you can start developing your solutions using the MapPoint web service API.

Downloading and setting up the MapPoint SDK

Once you have registered for the MapPoint Web Service account, you can download the MapPoint SDK from this URL.

To develop applications using the MapPoint SDK, you would require Visual Studio .NET to be installed in your machine. After the downloading is completed, install the SDK. The MapPoint SDK help gets integrated with your Visual Studio .NET help documentation. There are a lots of sample applications that are provided with the SDK (C# & VB.NET) which you can study for better understanding of the API.

Referencing the MapPoint Web Service WSDL

The web-service description document (mappoint.wsdl) is an XML document that defines the format of messages in use by MapPoint web service. Your development project must reference the 'mappoint.wsdl' to access the MapPoint Web Service SOAP API.

You can reference the WSDL using either standard http:// or https:// protocol. There are two 'mappoint.wsdl' files: one for staging and one for production. You can access these files using standard or secure HTTP:

Staging

http://staging.mappoint.net/standard-30/mappoint.wsdl

https://staging.mappoint.net/secure-30/mappoint.wsdl

Production

http://service.mappoint.net/standard-30/mappoint.wsdl

https://service.mappoint.net/secure-30/mappoint.wsdl

Note: Your developer trial account has access only to the staging 'mappoint.wsdl'.

Our MapPoint application

Our C# Windows application would use the MapPoint Web Service API to calculate the route/driving directions between two places (e.g. cities) and generate a map showing you the same. For example, if you want to reach London from Paris, our application would give you the driving directions starting from Paris and ending in London. It would be something like this:

The following are the main MapPoint classes that would be used in our application:

FindServiceSoap class

The FindServiceSoap service has several methods that deal with finding addresses and related information.

RenderServiceSoap class

The RenderServiceSoap service is used to work with maps.

RouteSpecification class

Contains all the information necessary to describe a route, including the array of route segments that make up a route, the data source, the driver profile, and an indication of whether driving directions and the calculated route representation (used for rendering a highlighted route on a map) should be included in a route.

MapSpecification class

Contains the specifications for rendering a map. Includes the data source to use, map views, pushpins, route, selected entities, and map options.

Waypoint class

Contains the start point, intermediate stops or end point of a route. Includes the requested location, name, snap type (an attribute that changes the way a waypoint functions when a route is created), and calculated location.

Route class

Represents a calculated route. Contains the specification of the route, the route itinerary, and a binary representation that can be used to render routes on a map.

RouteServiceSoap class

Contains the methods and properties related to calling the route service and obtaining point to point directions.

CommonServiceSoap class

The CommonServiceSoap service can be used to look up details that you might use for working with the other MapPoint API methods, such as a list of data sources that can be used in your queries.

Much of the information about the MapPoint classes and methods are described under various topics in the Help documentation.

To start the application development, we need to add reference to the 'mappoint.wsdl' in our project. The following steps show you how to add the web reference and setup the C# project:

Open Visual Studio .NET and select File > New > Project.

Select Visual C# project as the Project Type and Windows Application as the Template. For the project name, specify 'MapPoint_Demo'; for the path specify the location where you want the project to be created. Click OK to create the new project.

Add a reference to the MapPoint API in the staging environment by selecting Project > Add Web Reference. For the URL field, specify http://staging.mappoint.net/standard-30/mappoint.wsdl.

Click the GO button to make Visual Studio locate the MapPoint service. Name the Web Reference Name as MapPoint so that you can use a shorter name in your project.

Add the controls to the form as shown in figure (fig.1):

Add a CONFIG file (App.config) to the project and enter the following:

Once you have done this, compile and run the application. You will require an active internet connection for the application to run.

Select the zone ('MapPoint.EU' stands for Europe and 'MapPoint.NA' stands for North America). Then enter the starting and destination cities (for e.g. Paris and London). Click the 'Get Directions' button. The application will query the MapPoint web service and depending upon the speed of your internet connection, the result i.e. the driving directions will be returned.

Click on the 'Map' tab. You will see that the Route Map has been generated, the green line showing you the route from Paris to London.

You can get the driving/route directions for other cities in Europe and North America by changing the variables (zone, origin and destination addresses).

Currently MapPoint covers North America, Europe and Brazil however other zones would soon be added.

Though our application describes only a part of the functionalities that are being offered by the MapPoint API, other more complex functionalities can be thought of and implemented.

Requisites

VS.NET 2003

MapPoint Developer A/c

C#

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

thanks for this tutorial its great but i have a problem it does not work with visual studio 2008
i have a school project like this one
and i am asking if any one can help me to do like this project with visual basic.net 2008
and thankssssssssss

Hello,
I come from Spain and I do not speak English fluently. I have to make an application. NET to draw a road in MapPoint. Is this forum there is information that can help me?
If so try to pay attention.
Thank you. Excuse the expression of my mistakes.
Mila.

"i tried to follow the steps given in articel but was not successful. when i go to add web reference i will be asked for details such as username ,pwd and domain. i wanted to know what all these are" - raghavendra

I was wondering if the staging server is slower then the production server can anyone tell me ?

I also wonder what the costs are for using mappoint service in a WEB based comercial product on the web.

We have been trying to get a answer for many months and we now hear the costs are aprox €1500,- a month wish is in our case no option what so ever. Is this true or have we been missinformed as we tried to contact MS but they still need to respond our many requests for info and only a retailer could inform us of the price.

Hi sir
i have dowloaded your project and i have replaced the user name and password which you specified, i got a message error in connecting to the web service. i have also registered for the MapPoint web service API, i have also got a email from the microsoft that your request will be processed in 1 or 2 business days. i havnt got the username and password yet. i am also having error in adding the web referrence. will you please send you sugession to me. iam haveing a dialup connection.

Hi sir i am a novice with Mappoint applications..i have downloaded ur demo project and when i try to run it is showing an error "problem connecting with the service".Now further that since the web refernce is already there in ur code do i still need to add it..if yes ...then i tried but it is asking for for that staging url that u mentioned...i have the password and username ..but it is asking for a third option as domain...wat to enter there....
waiting for ur response

I am working as Mappoint developer in Davis Business Solutions. Chicago, USA. We have integrate routing and GPS to our application. In this we are getting small problem. Could you please helpout.

The problem is when we are changing from one country to another country we are getting error. Suppose we route two different locations in the US for one requewst. In the second request if we try to route two different locations in the Canada, we are getting error, becuase the country is not setting in the Location Find Dialogbox.