Home > Geopedia API > markers

markers

Controls the map markers, which are symbols placed on some geographic position on the map. If map is moved, the markers are moved with it.

Command JSON members:

  • command: markers,
  • operation: operation string (see below),
  • x: x coordinate number,
  • y: y coordinate number
  • index: <marker index, zero based>

"operation" can be one of the following:

  • add: waits for the user to mouse click to add a new marker
  • addXY: uses x and y members
  • remove: uses index member
  • clear: clears markers
  • get: returns a list of markers, same as "execute" command "getMarkers"

"get" operation returns:

  • markers: [<list of markers>] where markers consist of {x:<x>, y:<y>} pairs

No response is returned, except for "get" operation.

Examples:

Command: 
{"command":"markers","operation":"addXY","x":123.456,"y":987.654} 
{"command":"markers","operation":"remove","index":0} 
{"command":"markers","operation":"clear"} 
{"command":"markers","operation":"get"} 

Response: 
{"command":"markers","error":false,"markers":[ 
     {"x":123.456,"y":987.654}, {"x":111.222,"y":333.444} 
]}