Skip to main content

Marker Properties

You can get your api key to be used in this document here: https://apis.mappls.com/console/

Marker Properties Quick Reference:

Required Parameter

  • Map Object
  • Position: Lat Lng Object

Optional Parameter

  • fitbounds: Pans and zooms the map to contain its visible area within the specified geographical bounds. This function will also reset the map's bearing to 0 if bearing is nonzero. By default it is false.
    {
fitbounds: true
}
  • fitboundOptions: Options in fitbounds like padding and time duration.
    {
fitboundOptions: {padding: 120,duration:1000}
}
  • icon: Enter the url of the icon for marker.
    CORS should be enabled for absolute URL.
    {
icon: 'icon_url'
}
  • offset: Offset is used to set the correct position on the marker.
    {
offset: [x,y]
}
  • width: Define the icon width of the marker.
    {
width: 25
}
  • height: Define the icon height of the marker.
    {
height: 25
}
  • html: DOM element to use as a marker.
    html: '<div style="white-space:nowrap;font-size:10px;padding left:15px;color:#fff">Hello World</div>'
  • popupOptions: This includes the options to be used in showing the popup.
    {
popupOptions: {offset: {'bottom': [0, -20]}}
}
  • popupHtml: This shows the HTML you want on marker popup.
    {
popupHtml: 'MapmyIndia'
}
  • draggable: This property meant to drag the markers on the map. By default the value is false.
    {
draggable: false
}
  • clusters: To show the cluster on the map in case of multiple markers by geoJson. By default the value is true.
    {
clusters: true
}
  • clustersOptions: To show the multiple options we have on showing clusters on the map in case of multiple markers by geoJson.
    {
clustersOptions: {"color": "blue","bgcolor":"red"}
}
  • cType: It is for geojson data geometry
    • 0: for lat,lng combination (Default)
    • 1: for lng,lat conbination
    {
cType: 1
}