Skip to content
Simon Seyock edited this page Aug 14, 2019 · 12 revisions

map.api.cancelInteractions()

cancels current interaction (for example drawing a geometry)

Geometry API

map.api.geometry.draw(type, options)

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) })

map.api.geometry.show(wkt, options)

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.

map.api.geometry.hide(id)

Removes geometry with id

PrintToScale API

map.api.printToScale.showFrame(extent)

show Frame for printing to scale. extent should be an array with 4 elements [minx, miny, maxx, maxy].
Frame is draggable.

map.api.printToScale.getFrame()

Return current extent of frame

map.api.printToScale.hideFrame()

Hide frame (alternatively: map.api.cancelInteractions())

AlkisBuch API (not publicly available)

map.api.alkisBuch.selectByGeometry(wkt)

Select a geometry in alkisBuch

View API

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.

map.api.view.getCenter(options)

Returns current center of map

map.api.view.setCenter(coordinates, options)

Sets current center of map

map.api.view.getExtent(options)

Returns extent of the current view

map.api.view.fitExtent(extent, options)

Sets view to the given extent

map.api.view.getZoom()

Returns current zoom of map

map.api.view.setZoom(zoom)

Sets current zoom of map

Move API

map.api.move.toExtent(extent)

Move (animated) view to the given extent

map.api.move.toPoint(point)

Move (animated) view to the point

Transform API

map.api.transform.coordinate(coordinate, from, to)

Transform coordinate from one projection to another

map.api.transform.extent(extent, from, to)

Transform extentfrom one projection to another

map.api.transform.WKT(wkt, from, to)

Transform wktfrom one projection to another

Measure API

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².

map.api.measure.length(geom, options)

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.

map.api.measure.area(geom, options)

Measures the enclosed area of a polygon.

map.api.measure.distance(pointA, pointB, options)

Calculates the distance between pointA and pointB

Places API (not publicly available)

map.api.places.add(point, title, popuptext, options)

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.

map.api.places.clear()

Removes all places.

map.api.places.popup(id, options)

Shows the popup of the place with the id id. Centers the map to the place if options.center is not set to false.

map.api.places.extent()

Returns the extent of the current places.