Appearance
Ogma.geo
Geographical mode API : allows to display nodes which have geographical coordinates (latitude and longitude) on a map.
ogma.geo.disable([options])
Disables geo layout
Arguments
- options(optional)
GeoModeOptions
Returns
-
Promise<void>
ogma.geo.enable([options])
Enables geo mode layout
Arguments
- options(optional)
GeoModeOptions
Returns
-
Promise<void>
ogma.geo.enabled()
Check whether geographical mode is enabled.
Returns
-
boolean
ogma.geo.getCenter()
Returns current map position. Returns undefined when the Geo mode is disabled.
Returns
ogma.geo.getMap()
Get the underling map object (a Leaflet Map instance). Returns null when the Geo mode is disabled.
Returns
-
Map
ogma.geo.getOptions()
Get module settings.
Returns
ogma.geo.getUnprojectedCoordinates([selector])
Returns underlying X and Y positions for the nodes that are currently handled by the geo-mode.
Arguments
Returns
-
Array<{x: number, y: number}>
ogma.geo.getView()
Returns current map position. Returns undefined when the Geo mode is disabled.
Returns
ogma.geo.getZoom()
Returns current map zoom level. Returns undefined when the Geo mode is disabled.
Returns
-
number
ogma.geo.resetCoordinates()
Reset geographical coordinates of the nodes to the initial values
ogma.geo.runLayout(parameters)
Helper method to get the geo coordinates for the nodes that don't have them, if you want to position them on the map in a specific way using one of the layouts.
Arguments
- parameters
object
- center(optional)
GeoCoordinate
A coordinate to use as the center of the layout. If not provided, the algorithm will try to use the average of the coordinates of the nodes that have geo coordinates. If none of them do and the center is not provided explicitly, an error will be thrown. - latitudePath(optional)
PropertyPath
[='latitude']
Node path which contains the latitude. - longitudePath(optional)
PropertyPath
[='longitude']
Node path which contains the longitude. - nodes(optional)
NodeList
Nodes to layout. If not provided, all nodes will be used. - options
LayoutOptions
Layout options. Respective layout options can be found in the layout documentation. - type
'force'|'forceLink'|'hierarchical'|'sequential'|'grid'|'radial'|'concentric'
Layout name
- center(optional)
Returns
-
Promise<GeoCoordinate[]>
ogma.geo.setCenter(latitude, longitude)
Centers the map at given coodinates
Arguments
- latitude
number
- longitude
number
ogma.geo.setOptions([options])
Update module settings
Arguments
- options(optional)
GeoModeOptions
ogma.geo.setView(latitude, longitude, zoom)
Set map view - coordinates and zoom level
Arguments
- latitude
number
- longitude
number
- zoom
number
ogma.geo.setZoom(zoom)
Sets zoom level of the map
Arguments
- zoom
number
ogma.geo.toggle([options])
Toggles geo mode. Useful when you don't want to store information about whether the mode was on or off(e.g. with an UI switcher).
Arguments
- options(optional)
GeoModeOptions
Returns
-
Promise<void>