Skip to content

AnsynApi Functions

Tzahi Levi edited this page Dec 29, 2019 · 9 revisions

after we inject the AnsynApi service in our component we can use ansynApi functions for change things in out app.

AnsynApi Functions

goToPosition(point)

set the map position to the point coordinate

parameters:

  • point

a geoJson point

changeMapLayout(layout)

change the layout of the maps

parameters:

  • layout

could be one of the follow:
layout1 - show one map.
layout2 - show 2 maps side by side horizontally.
layout3 - show 2 maps side by side vertically.
layout4 - show 3 maps, one on left and 2 smaller on the right vertically.
layout5 - show 3 maps one on top and 2 smaller on bottom horizontally.
layout6 - show 4 maps.

displayOverlay(overlay)

display the overlay on the map.

parameters:

  • overlay

an overlay object

collapseMenu(collapse)

minimize/maximize the side menu

parameters:

  • collapse

boolean, true for minimize false for maximize.

collapseFooter(collapse)

minimize/maximize the timeline-status-bar

parameters:

  • collapse

boolean, true for minimize false for maximize.

insertLayer(layerName, layerData, isEditable)

add the layer to app data layers
return the layer id.

parameters:

  • layerName

string, the display layer name

  • layerData

a geoJson FeatureCollection

  • isEditable

boolean, true if the layer could be editable, false otherwise.

removeLayer(layerId)

remove the layer with the layerId from the app data layers

parameters:

  • layerId

string, the layer id to be remove.

showLayer(layerId, show)

show/hide the layer with the layerId

parameters:

  • layerId

string, the layer id to be show/hide

  • show

boolean, true to show the layer, false to hide the layer.

getOverlayData(mapId)

return the overlay data currently display on the map with the mapId.

parameters:

  • mapId

string, the id of the map which from to get the overlay data or the active map if id not provide.

getMapPosition()

return the current mapPosition

getOverlays()

return all the overlays currently on the timeline.

setAnnotations(features)

draw the annotations on the map.

parameters:

  • features

click here for more details on the features object.

setOverlays(overlays)

put the overlays on the timeline status bar.

parameters:

  • overlays

an array of overlay

setMapPositionByRadius(point, radius, search)

set the position of the map to point with radius

parameters:

  • point

a geoJson point.

  • radius

number, the radius in meters.

  • search

boolean, if true the app search for overlays in the position.

setMapPositionByRect(rect)

set the map position to the follow rect.

parameters:

  • rect

a geoJson polygon

setRotation(degree, mapId)

rotate the map by degree

parameters:

  • degree

a number between 0-360.

  • degree

the id of the map to be rotate or the active map if not provide.

setOutSourceMouseShadow(geoPoint)

set a shadow mouse indicator on the geoPoint coordinate

parameters:

  • geoPoint

a geoJson point

setOverlaysCriteria(criteria, radiusInMetersBuffer)

change the search criteria and apply a new search

parameters:

  • criteria

a search criteria object.

  • radiusInMetersBuffer

number, radius to be add to the region criteria.

setMinimalistViewMode(collapse)

set the app to minimalist view

parameters:

  • collapse

boolean, true to enable minimalist view, false to disable.

deleteAllAnnotations()

clear all the annotations from the map.

click for more information about geoJson object