Markers > Custom Shapes & Image Icons |
Throughout our previous examples, we had used the default shapes provided by FusionMaps (circle, arc, diamond or triangle) as our marker shapes and customized their border and background color. However, FusionMaps provides you with many more options for marker shapes like defining your custom shape and loading external images as icons. To do so, you'll need to use the SHAPES feature of markers, as explained here. Before jumping to any code, let's see an example first. |
In the above map, we've used custom image icons to show various offices around the world. Also, we've used custom tool text for each marker to show more information, as shown below: |
The XML code for this map can be reproduced as under: |
<map animation='0' showShadow='0' showBevel='0' showLabels='0' showMarkerLabels='1' fillColor='F1f1f1' borderColor='CCCCCC' baseFont='Verdana' baseFontSize='10' markerBorderColor='000000' markerBgColor='FF5904' markerRadius='6' legendPosition='bottom' useHoverColor='0' showToolTip='0' showMarkerToolTip='1' > |
Though the XML looks pretty long because of a lot of things we've put up in this, we'll concentrate on just the custom shapes part. You'll see that we've introduced the new <shapes> and its children <shape> elements in this code. These elements help you define custom shapes that markers on your map can use. Note that it's not necessary to define <shapes> or <shape> to use markers. If not defined, you can still use the default marker shapes provided by FusionMaps. Each custom shape needs to be present as a <shape> element (inside <shapes> element). It can have a lot of attributes as explained below. |
Attributes for <shape> element. |
The <shape> element can have a lot of functional and cosmetic attributes. Of all of them, only the following are compulsory:
Additionally, you can set the following properties for each marker shape:
And, the following attributes apply only if you're plotting an image marker shape:
|