Docs

Map JS API

This Topic presents examples where user interact with map items #

Activate a drawing mode in the JS API to draw on the map directly with the mouse – SwitchMode. The following mode is available :

  • draw_polygon : Draw a polygon on the map. When the polygon is created, the mode automatically switch to SelectMode.
  • draw_line_string : Draw a line the map. When the line is created, the mode automatically switch to SelectMode.
  • draw_point : Draw a point/marker on the map. When the point is created, the mode automatically switch to SelectMode.
  • draw_circle : Draw a circle on the map. When the point is created, the mode automatically switch to SelectMode.

When an item has been created with manual mode, the callback specified (if any) in the SwitchMode function is called with the item in argument.

Also, the function “SwitchMode” is called with an Options parameters :

var options = {
  layerId: layerId, // The layerId which will be assigned to the created item
  isShared: false, // Indicates if the new created item will be shared or not
  isLocked: false, // Indicates if the new created item will be locked or not
  defaultItemName: "default", // Indicates the default name of the new created item
  defaultItemStyles: { // It is possible to assign specific style to the new created item
     "style.color": "#FF0000"
  }
};

Help Guide Powered by Documentor
Suggest Edit