-
Notifications
You must be signed in to change notification settings - Fork 5
JS API
cancels current interaction (for example drawing a geometry)
draw geometry on map.
type can be 'Point'
, 'LineString'
, 'Polygon'
, 'Circle'
or 'Box'
.
options is a javascript object can have the following properties:
-
srId
: If set the resulting coordinates will be transformed to this projection. Should be a common identifier (i.e.'EPSG:4326'
). Defaults to map projection. -
format
: Can be'wkt'
or'array'
. Determines the output format of the geometry. Defaults to'wkt'
-
style
: Can be a style or styleId referring to style configured in the client config. Defaults to'#drawStyle'
-
cssCursor
: Set a css cursor. See https://developer.mozilla.org/en-US/docs/Web/CSS/cursor for possible values. Defaults to'crosshair'
-
cursorRadius
: If set to value > 0, a circle under the mouse pointer is shown. Default to 0. -
showCircleRadius
: If set to true a line showing the length of the drawn circle is shown. Defaults to false.
Returns promise with the drawn data or null
if the interaction has been cancelled.
example:
map.api.geometry.draw('Point', { srId: 'EPSG:4326' }).then(function (wkt) { console.log(wkt) })
Shows a geometry on the map. wkt should be a wkt string.
Returns id that can be used to remove the geometry from the map.
Removes geometry with id
show Frame for printing to scale. extent
should be an array with 4 elements [minx, miny, maxx, maxy].
Frame is draggable.
Return current extent of frame
Hide frame (alternatively: map.api.cancelInteractions())
Select a geometry in alkisBuch
All methods that accept or return a spatial value support an options object parameter that can have a property projection to transform the input or output. The options are optional.
Returns current center of map
Sets current center of map
Returns extent of the current view
Sets view to the given extent
Returns current zoom of map
Sets current zoom of map
Move (animated) view to the given extent
Move (animated) view to the point
Transform coordinate from one projection to another
Transform extentfrom one projection to another
Transform wktfrom one projection to another
Measure lengths and areas of geometries and distances of points. The options object is optional. options.format
determines the input format. It defaults to 'wkt'
and can be set to 'array'
. All values are in m or m².
Measures length of line strings or in case of a polygon sums all rings. If options.format
is set to 'array'
the input is always interpreted as a LineString.
Measures the enclosed area of a polygon.
Calculates the distance between pointA
and pointB
Add a Place to the map. The point should be given as a wkt by default, but can also be provided as an array if options.format
is 'array'
.
The title will be shown on mouseover and as the popup title. The popuptext will be shown inside the popup.
If options.projection
is set to an EPSG code (i.e. 'EPSG:4326'
) the point will be transformed to the map coordinate system before use.
The function returns an id for the place.
Removes all places.
Shows the popup of the place with the id id
. Centers the map to the place if options.center
is not set to false
.
Returns the extent of the current places.