MapImage.HotAreas Property
Contains the areas of the map that are clickable (HotArea[] objects). Useful for constructing an HTML image map.
Public Dim HotAreas As [Namespace].HotArea()
Member of [Namespace].MapImage
[C#]
public [Namespace].HotArea[] HotAreas
Member of [Namespace].MapImage
Remarks
- The order of the hot areas returned does not necessarily match the order of the pushpin array in the MapSpecification.Pushpins property passed in the RenderServiceSoap.GetMap method. This may occur because some of the passed pushpins aren't located within the boundaries of a rendered map or because some of the pushpins aren't identified as being a hot area. Match the HotArea.PinID and Pushpin.PinID properties to identify which hot area correspond to which pushpin.
- To identify a pushpin as a hot area for use in creating an image map, use the Pushpin.ReturnsHotArea property.
Example
[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 and mark the center point with a pushpin
Dim myViews(0) As ViewByHeightWidth
myViews(0) = New ViewByHeightWidth()
myViews(0).CenterPoint = New LatLong()
myViews(0).CenterPoint.Latitude = 40
myViews(0).CenterPoint.Longitude = -120
myViews(0).Height = 200
myViews(0).Width = 300
Dim myPushpins(0) As Pushpin
myPushpins(0) = New Pushpin()
myPushpins(0).PinID = "pin1"
myPushpins(0).IconDataSource = "MapPoint.Icons"
myPushpins(0).IconName = "3"
myPushpins(0).LatLong = myViews(0).CenterPoint
myPushpins(0).Label = "Center"
myPushpins(0).ReturnsHotArea = True
Dim mapSpec As New MapSpecification()
mapSpec.DataSourceName = "MapPoint.NA"
mapSpec.Views = myViews
mapSpec.Pushpins = myPushpins
Dim mapImages() As MapImage
mapImages = renderService.GetMap(mapSpec)
'Output the hot area coordinates of the pushpin icon and
'label rectangles
Console.WriteLine("PinID:" + mapImages(0).HotAreas(0).PinID)
Console.WriteLine("IconRectangle top coordinate: " + mapImages(0).HotAreas(0).IconRectangle.Top.ToString())
Console.WriteLine("IconRectangle bottom coordinate: " + mapImages(0).HotAreas(0).IconRectangle.Bottom.ToString())
Console.WriteLine("IconRectangle left coordinate: " + mapImages(0).HotAreas(0).IconRectangle.Left.ToString())
Console.WriteLine("IconRectangle right coordinate: " + mapImages(0).HotAreas(0).IconRectangle.Right.ToString())
Console.WriteLine("LabelRectangle top coordinate: " + mapImages(0).HotAreas(0).LabelRectangle.Top.ToString())
Console.WriteLine("LabelRectangle bottom coordinate: " + mapImages(0).HotAreas(0).LabelRectangle.Bottom.ToString())
Console.WriteLine("LabelRectangle left coordinate: " + mapImages(0).HotAreas(0).LabelRectangle.Left.ToString())
Console.WriteLine("LabelRectangle right coordinate: " + mapImages(0).HotAreas(0).LabelRectangle.Right.ToString())
[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 and mark the center point with a pushpin
ViewByHeightWidth[] myViews = new ViewByHeightWidth[1];
myViews[0] = new ViewByHeightWidth();
myViews[0].CenterPoint = new LatLong();
myViews[0].CenterPoint.Latitude = 40;
myViews[0].CenterPoint.Longitude = -120;
myViews[0].Height = 200;
myViews[0].Width = 300;
Pushpin[] myPushpins = new Pushpin[1];
myPushpins[0] = new Pushpin();
myPushpins[0].PinID = "pin1";
myPushpins[0].IconDataSource = "MapPoint.Icons";
myPushpins[0].IconName = "3";
myPushpins[0].LatLong = myViews[0].CenterPoint;
myPushpins[0].Label = "Center";
myPushpins[0].ReturnsHotArea = true;
MapSpecification mapSpec = new MapSpecification();
mapSpec.DataSourceName = "MapPoint.NA";
mapSpec.Views = myViews;
mapSpec.Pushpins = myPushpins;
MapImage[] mapImages = renderService.GetMap(mapSpec);
//Output the hot area coordinates of the pushpin icon and
//label rectangles
Console.WriteLine("PinID:" + mapImages[0].HotAreas[0].PinID);
Console.WriteLine("IconRectangle top coordinate: " + mapImages[0].HotAreas[0].IconRectangle.Top.ToString());
Console.WriteLine("IconRectangle bottom coordinate: " + mapImages[0].HotAreas[0].IconRectangle.Bottom.ToString());
Console.WriteLine("IconRectangle left coordinate: " + mapImages[0].HotAreas[0].IconRectangle.Left.ToString());
Console.WriteLine("IconRectangle right coordinate: " + mapImages[0].HotAreas[0].IconRectangle.Right.ToString());
Console.WriteLine("LabelRectangle top coordinate: " + mapImages[0].HotAreas[0].LabelRectangle.Top.ToString());
Console.WriteLine("LabelRectangle bottom coordinate: " + mapImages[0].HotAreas[0].LabelRectangle.Bottom.ToString());
Console.WriteLine("LabelRectangle left coordinate: " + mapImages[0].HotAreas[0].LabelRectangle.Left.ToString());
Console.WriteLine("LabelRectangle right coordinate: " + mapImages[0].HotAreas[0].LabelRectangle.Right.ToString());
See Also
MapImage Class | HotArea Class | MapSpecification.Pushpins Property | RenderServiceSoap.GetMap Method | HotArea.PinID Property | Pushpin.PinID Property | Pushpin.ReturnsHotArea Property