Export (0) Print
Expand All

Using the MapPointTravel Data Sources

MapPoint Web Service is deprecated and will be retired November 18, 2011. Please go to http://www.microsoft.com/maps/mappoint.aspx for information about upgrading to Bing Maps.

You can show real-time traffic incidents (accidents, slow moving traffic, construction, and other traffic-related information) in your MapPoint Web Service maps for several major metropolitan areas in the United States. MapPoint Web Service provides different data sources for the regions that have traffic information and for the specific traffic incidents.

MapPoint Web service includes two data sources that provide support for including traffic incident information in your maps: MapPointTravel.TrafficAreas and MapPointTravel.TrafficIncidents.

Using MapPointTravel.TrafficAreas

Traffic areas are predefined polygons of metropolitan areas in the United States for which traffic incident information is available. You use the MapPointTravel.TrafficAreas data source to get these polygons. Like other polygon data sources, each polygon in the MapPointTravel.TrafficAreas data source includes properties defining the name, country/region, and the four corners of the bounding rectangle:

Property

Description

Country/Region

The country or region in which the polygon is contained (for example, "United States").

Name

The name of the metropolitan area (for example, "Albany").

NELat

The latitude of the northeast corner of the bounding rectangle.

NELong

The longitude of the northeast corner of the bounding rectangle.

SWLat

The latitude of the southwest corner of the bounding rectangle.

SWLong

The longitude of the southwest corner of the bounding rectangle.

Note Do not reference the entity ID values of the MapPointTravel.TrafficAreas data source in your code, as the entities in this data source are subject to change.

The following code shows how to populate a dropdown list with all of the traffic areas in the United States. It creates a bounding rectangle for the United States, and then calls FindPolygon to return each of the traffic areas.

LatLong llNE = new LatLong();
llNE.Latitude = 50;
llNE.Longitude=-66;
LatLong llSW = new LatLong();
llSW.Latitude=24;
llSW.Longitude=-124;

LatLongRectangleSpatialFilter sf = new LatLongRectangleSpatialFilter();
sf.BoundingRectangle = new LatLongRectangle();
sf.BoundingRectangle.Northeast = llNE;
sf.BoundingRectangle.Southwest = llSW;

FindPolygonSpecification fps = new FindPolygonSpecification();
fps.DataSourceName = "MapPointTravel.TrafficAreas";
fps.Filter = new FindFilter();
fps.Filter.EntityTypeName="TrafficArea";
fps.SpatialFilter = sf;
fps.Options = new FindOptions();
fps.Options.Range = new FindRange();
fps.Options.Range.Count = 250;

FindResults foundResults = finder.FindPolygon(fps);
foreach(FindResult fr in foundResults.Results)
{
   ListItem li = new  ListItem(
      fr.FoundLocation.Entity.Properties[0].Value.ToString(), 
      fr.FoundLocation.Entity.ID.ToString());
   listAreas.Items.Add(li);
}

Using MapPointTravel.TrafficIncidents

The MapPointTravel.TrafficIncidents data source contains all of the real-time traffic incidents. It supports the CanFindNearby capability, which allows you to find traffic incidents based on the traffic area (FindByProperty), near a specific route (FindNearRoute), or near a specific location (FindNearby).

Traffic incidents are points and include the following properties:

Property

Data Type

Description

Created

DateTime

The date and time when the traffic incident data was created. The MapPoint Web Service always returns this DateTime data in Pacific Time, regardless of the location of the traffic incident. You should verify whether your SOAP stack automatically converts this data to UTC time.

Divert

String

Specifies whether this incident is causing a traffic diversion. Values are either True or False.

ExpectedDelay

String

The estimated traffic slowdown caused by the incident.

ExpectedDuration

String

The estimated amount of time that the incident will persist.

FullDescription

String

A full description of the traffic incident.

LastUpdated

DateTime

The date and time when the traffic incident data was last updated. The MapPoint Web Service always returns this DateTime data in Pacific Time, regardless of the location of the traffic incident. You should verify whether your SOAP stack automatically converts this data to UTC time.

Name

String

A name assigned to the specific incident. Typically a description (street name, intersection, etc.) of where the incident is occurring.

Severity

String

The severity of the incident. Values for this property include Severe, High, Medium, Low, and Unknown.

StandardMessage

String

A brief description of the incident type.

TrafficAreaID

int

The EntityID of the TrafficArea polygon which contains this incident.

Note Do not reference the value of this property in your code, as the entities in the MapPointTravel.TrafficIncidents data source are subject to change.

The following code shows how to return all of the traffic incidents near a specific route:

FindFilter ff = new FindFilter();
ff.EntityTypeName = "TrafficIncident";

FindNearRouteSpecification spec = new FindNearRouteSpecification();
spec.DataSourceName="MapPointTravel.TrafficIncidents";
spec.Distance=1; //show all incidents within 1 mile of the route
spec.Route = myRoute; //myRoute has been previously defined 
spec.Filter = ff;

FindResults foundResults = new FindResults();
foundResults = finder.FindNearRoute(spec);
Show:
© 2014 Microsoft