Share via


MapPoint Web Service Sample Code

MapPoint Web Service Sample Code

The MapPoint Web Service SDK includes several samples that demonstrate how to use MapPoint Web Service features in applications. The samples are installed as Microsoft Visual Studio .NET solution files, and are available in Visual Basic .NET and Microsoft® Visual C#™ languages.

You must have Visual Studio .NET installed on your computer to run these applications. Otherwise, you can view the source files in Notepad or any text editor.

In This Section

Core Functionality Samples

This is a set of samples that shows how to use the basic MapPoint Web Service functionality: find a place, find an address, find nearby locations, get a map, and route between locations. This sample has been updated to find entities by using the new FindServiceSoap.FindByID and FindServiceSoap.FindByProperty methods. These samples are ASP.NET Web applications.

Client-Side Point to Latitude/Longitude Conversion Sample

This sample shows how to convert a point to latitude/longitude on client-side (without calling the MapPoint Web Service).

Click to Center Map Sample

This sample Windows application uses the RenderServiceSoap.ConvertToLatLong method to re-center a map image based on the pixel coordinate where the end-user clicks. The latitude and longitude coordinates of the map, as well as the pixel coordinate of the image are displayed below the map. Additionally, the FindServiceSoap.GetLocationInfo method is used to identify the county for the area on the map where the user clicked.

Drag Pushpin on Map Sample

This sample Windows application allows the end-user to place and relocate pushpins by dragging them and dropping them onto a map. The sample application uses the RenderServiceSoap.ConvertToLatLong method to get the location and FindServiceSoap.GetLocationInfo method to get address information for the pushpin. This information is displayed in a grid next to the map.

Icon Collision Avoidance and Suppression Sample

This application shows how to control which icons are displayed on a map, and how to prevent icon collisions.

Image Map Sample

In this ASPX Web application, the user can click a pushpin on the map and relevant information about the pushpin is displayed on the Web page.

Inset Overview Map Sample

This ASPX Web application displays a small overview map of the current map view. The sample makes use of the FindServiceSoap.GetLocationInfo method to find out which entities the current location is a part of. From this list of entities, an overview entity is chosen and a map of the entity is displayed.

LineDrive Map Sample

This application shows how to render LineDrive maps and directions.

Mobile Application Sample

This Mobile Web application requires the Microsoft Mobile Internet Toolkit to run. This sample asks the end-user for an address and then displays a list of nearby coffee stores (using the sample customer data source MapPoint.FourthCoffeeSample). When the end-user selects a store location, a map and directions to the store are displayed.

Pan Map Navigation Control Sample

In this ASPX Web application, the end-user can pan the map by dragging it to a new location. Once the mouse button is released, the RenderServiceSoap.ConvertToLatLong method is used to find the new center LatLong object. This sample also demonstrates use of the zoom feature.

In this ASPX Web application, the end-user can pan the map by dragging it to a new location. Once the mouse button is released, the RenderServiceSoap.ConvertToLatLong method is used to find the new center LatLong object. This sample also demonstrates use of the zoom feature.

Polygons Sample

This application shows how to render polygons on a map, and how to determine if a point is within a polygon.

Store Locator Sample

This is a complete sample store locator ASPX Web application. This sample application asks the end-user for an address and then displays a list of nearby coffee stores (using the sample customer data source MapPoint.FourthCoffeeSample). When the end-user selects a store location, a map and directions to the store are displayed.

Traffic Map Sample

This application shows how to use the MapPointTravel.TrafficIncidents and MapPointTravel.TrafficAreas data sources to generate maps that show current traffic conditions.

Turn-by-Turn Route Maps Sample

In this ASPX Web application, the end-user enters two place strings, which are sent to MapPoint Web Service to return possible matches. Then the sample routes between the two points and displays a list of directions and each corresponding map view.