Share via


Choosing which Icons to Display

Choosing which Icons to Display

MapPoint Web Service provides numerous built-in points of interest that you can use with your maps. You can select which categories of icons to display when your maps are rendered.

Using the HideEntityTypes Property

Depending on the map view and scale, some or all of the points of interest within the map area will be automatically rendered. However, there may be times when you do not want to display some or all of these points of interest.

To hide points of interest, you can use the HideEntityTypes property of the MapSpecification class. This property takes a string array that contains the point-of-interest categories that you do not want displayed on your maps. The following table lists the categories for built-in points of interest and the string value that you use to suppress each one.

Entity type

String value

Airports

"Airport"

Convention centers

"ConventionCenter"

Hospitals

"Hospital"

Metro stations and subways

"MetroStation"

Points of interest that do not fit into another category

"Other"

Park-and-ride facilities and other parking areas

"ParkAndRide"

Police stations

"PoliceStation"

Railway stations

"RailwayStation"

Rest areas

"RestArea"

Schools

"School"

Shopping centers

"ShoppingCenter"

Tourist points of interest

"Tourist"

All points of interest

"All"

The following example code prevents all police stations, schools, tourist points of interest, and other points of interest from being displayed on a map:

[Visual Basic] 
'This example assumes that the service instance 
''renderService' has already been created and that 
'the MapPoint Web Service namespace has been imported. 

'Get a map using height and width. Suppress the display
'of schools, tourist points of interest, police stations, 
'and points of interest that do not fall into any of the
'other categories.

Dim myViews(0) As ViewByHeightWidth
myViews(0) = New ViewByHeightWidth()
myViews(0).CenterPoint = New LatLong()
myViews(0).CenterPoint.Latitude = 43.65900
myViews(0).CenterPoint.Longitude = -70.25400
myViews(0).Height = 200
myViews(0).Width = 300

Dim mapSpec As New MapSpecification()
mapSpec.DataSourceName = "MapPoint.NA"
mapSpec.Views = myViews
mapSpec.HideEntityTypes = New String() {"School", _
  "Tourist", _
  "PoliceStation", _
 "Other" }
Dim mapImages() As MapImage
mapImages = renderService.GetMap(mapSpec)

[C#]
//This example assumes that the service instance 
//'renderService' has already been created and that 
//the MapPoint Web Service namespace has been imported. 

//Get a map using height and width. Suppress the display
//of schools, tourist points of interest, police stations, 
//and points of interest that do not fall into 
//any of the other categories.

ViewByHeightWidth[] myViews = new ViewByHeightWidth[1];
myViews[0] = new ViewByHeightWidth();
myViews[0].CenterPoint = new LatLong();
myViews[0].CenterPoint.Latitude = 43.65900;
myViews[0].CenterPoint.Longitude = -70.25400;
myViews[0].Height = 200;
myViews[0].Width = 300;

MapSpecification mapSpec  = new MapSpecification();
mapSpec.DataSourceName = "MapPoint.NA";
mapSpec.Views = myViews;
mapSpec.HideEntityTypes= new string[]{"School", _
  "Tourist", _
  "PoliceStation", _
 "Other" };

MapImage[] mapImages;
mapImages = renderService.GetMap(mapSpec);


The following figure shows a map with several built-in points of interest suppressed by passing a string array that contains the values "School", "Tourist", "PoliceStation", and "Other" to the HideEntityTypes property. Note also that the PreventIconCollisions property is set to true.