Constructor for a MapViewer, setting:
map properties
language instance
StaticDEFAULT_StaticINIT_Add a new custom component to the map
An id to the new component
The component to add
Add a localization ressource bundle for a supported language (fr, en). Then the new key added can be access from the utilies function getLocalizesMessage to reuse in ui from outside the core viewer.
The language to add the ressoruce for (en, fr)
The translation object to add
Hide a click marker from the map
Transforms coordinate from map projection to given projection.
The given coordinate
The projection that should be output
The coordinate in the map projection
Transforms coordinate from given projection to the current projection of the map.
The given coordinate
The projection of the given coordinate
The coordinate in the map projection
Transforms coordinate from LonLat to the current projection of the map.
The LonLat coordinate
The coordinate in the map projection
Transforms coordinate from current projection of the map to LonLat.
The coordinate in map projection
The coordinate in LonLat
Transforms extent from map projection to given projection. If the projects are the same, the extent is simply returned.
The given extent
The projection that should be output
The extent in the map projection
Transforms extent from given projection to the current projection of the map.
The given extent
The projection of the given extent
The number of stops to perform densification on the extent
The extent in the map projection
Transforms extent from LonLat to the current projection of the map.
The LonLat extent
The number of stops to perform densification on the extent
The extent in the map projection
Transforms extent from current projection of the map to LonLat.
The extent in map projection
The extent in LonLat
Create an Open Layer map from configuration attached to the class. This function is called from a useEffect and should be running synchronously.
HTML element to create the map within
The OpenLayer map
Creates a map config based on current map state.
Indicates if geocore layer names should be kept as is or returned to defaults. Set to false after a language change to update the layer names with the new language.
Map config with current map state.
Deletes the MapViewer, including its plugins, layers, etc. This function does not unmount the MapViewer. To completely delete a MapViewer, use cgpv.api.deleteMapViewer() which will delete the MapViewer and unmount it - for React.
Emits a map single click event.
The clicked coordinates to emit.
Asynchronously gets the map center coordinate to give a chance for the map to render before returning the value.
the map center
Asynchronously gets the map coordinate from pixel to give a chance for the map to render before returning the value.
The pixel coordinate to convert
The maximum time in milliseconds to wait for the getCoordinateFromPixel to return a value.
The map coordinate at the given pixel location
Retrieves the configuration object for a specific core plugin from the map's features configuration.
The ID of the core plugin to look up.
The configuration object for the specified plugin, or undefined if not found.
Returns the current display language
The display language
Returns the current display theme
The display theme
Gets the i18nInstance for localization.
The i18n instance
Asynchronously gets the map size to give a chance for the map to render before returning the value.
The map size
Get north arrow bearing. Angle use to rotate north arrow for non Web Mercator projection https://www.movable-type.co.uk/scripts/latlong.html
the arrow angle
Gets if north is visible. This is not a perfect solution and is more a work around
true if visible, false otherwise
Asynchronously attempts to get a plugin by its id.
The plugin id
The plugin
Gets the map projection
The map projection
Gets the map viewSettings
the map viewSettings
Initializes drawing interactions on the given vector source
The geometry group key in which to hold the geometries
The type of geometry to draw (Polygon, LineString, Circle, etc)
OptionalgeometryFunction: GeometryFunctionInitializes extent interactions
Initializes map, layer class and geometries. This function must be called once the Map is rendered
Initializes modifying interactions on the given vector source
The geometry group key in which to hold the geometries
Optionalstyle: TypeFeatureStyleOptionalinsertVertexCondition: ConditionOptionalpixelTolerance: numberInitializes selection interactions
Initializes snapping interactions on the given vector source
The geometry group key in which to hold the geometries
Initializes transform interactions for feature manipulation
Optionaloptions: Partial<TransformOptions>Options for the transform interaction
Initializes translation interactions
Initializes translation interactions without requireing the extra selection click. Note: This will limit translation interactions to one feature at a time.
Unregisters a map change size event callback.
The callback to stop being called whenever the event is emitted
Unregisters a component added event callback.
The callback to stop being called whenever the event is emitted
Unregisters a component removed event callback.
The callback to stop being called whenever the event is emitted
Unregisters a map init event callback.
The callback to stop being called whenever the event is emitted
Unregisters a component removed event callback.
The callback to stop being called whenever the event is emitted
Unregisters a map layers loaded event callback.
The callback to stop being called whenever the event is emitted
Unregisters a map layers processed event callback.
The callback to stop being called whenever the event is emitted
Unregisters a map move end event callback.
The callback to stop being called whenever the event is emitted
Unregisters a map pointer move event callback.
The callback to stop being called whenever the event is emitted
Unregisters a map pointer stop event callback.
The callback to stop being called whenever the event is emitted
Unregisters a map change size event callback.
The callback to stop being called whenever the event is emitted
Unregisters a map ready event callback.
The callback to stop being called whenever the event is emitted
Unregisters a map rotation event callback.
The callback to stop being called whenever the event is emitted
Unregisters a map single click end event callback.
The callback to stop being called whenever the event is emitted
Unregisters a map zoom end event callback.
The callback to stop being called whenever the event is emitted
Registers a map change size event callback.
The callback to be executed whenever the event is emitted
Registers a component added event callback.
The callback to be executed whenever the event is emitted
Registers a component removed event callback.
The callback to be executed whenever the event is emitted
Registers a map init event callback.
The callback to be executed whenever the event is emitted
Registers a component removed event callback.
The callback to be executed whenever the event is emitted
Registers a map layers loaded event callback.
The callback to be executed whenever the event is emitted
Registers a map layers processed event callback.
The callback to be executed whenever the event is emitted
Registers a map move end event callback.
The callback to be executed whenever the event is emitted
Registers a map pointer move event callback.
The callback to be executed whenever the event is emitted
Registers a map pointer stop event callback.
The callback to be executed whenever the event is emitted
Registers a map projection change event callback.
The callback to be executed whenever the event is emitted
Registers a map ready event callback.
The callback to be executed whenever the event is emitted
Registers a map rotation event callback.
The callback to be executed whenever the event is emitted
Registers a map single click event callback.
The callback to be executed whenever the event is emitted
Registers a map zoom end event callback.
The callback to be executed whenever the event is emitted
Loops through all geoview layers and refresh their respective source. Use this function on projection change or other viewer modification which may affect rendering.
Register handlers on pointer move and map single click
Map to register events on
Remove an existing custom component from the map
The id of the component to remove
Searches through a map config and replaces any matching layer names with their provided partner.
The array of name pairs. Presumably one english and one french name in each pair.
OptionalmapConfig: TypeMapFeaturesConfigThe config to modify, or one created using the current map state if not provided.
Whether or not names not provided should be removed from config.
Map config with updated names.
Rotates the view to align it at the given degrees
The degrees to rotate the map to
Set map extent.
New extent to zoom to.
A promise that resolves when the zoom operation completes.
set fullscreen / exit fullscreen
Toggle fullscreen or exit fullscreen status
The element to toggle fullscreen on
Update nav bar home button view settings.
The new view settings.
Set map to either dynamic or static
Map interaction
Set the display language of the map
The language to use (en, fr)
OptionalreloadLayers: booleanSet the maximum extent of the map.
New extent to use.
Set the maximum map zoom level.
New maximum zoom level
Set the minimum map zoom level.
New minimum zoom level
Set the display projection of the map
The projection code (3978, 3857)
Set the display theme of the map
The theme to use (geo.ca, light, dark)
Set the map viewSettings (coordinate values in lon/lat)
Map viewSettings object
Set the map zoom level.
New zoom level
Unregister handlers on pointer move and map single click
Map to unregister events on
Update the size of the icon image list based on styles.
The legend to check.
Waits until all GeoView layers reach the specified status before resolving the promise.
This function repeatedly checks whether all layers have reached the given layerStatus.
The desired status to wait for (e.g., 'loaded', 'processed').
A promise that resolves with the number of layers that have reached the specified status.
Zoom to the specified extent.
The extent to zoom to.
Optionaloptions: FitOptionsThe options to configure the zoomToExtent (default: { padding: [100, 100, 100, 100], maxZoom: 11 }).
A promise that resolves when the zoom operation completes.
Zoom to specified extent or coordinate provided in lonlat.
The extent or coordinate to zoom to.
Optionaloptions: FitOptionsThe options to configure the zoomToExtent (default: { padding: [100, 100, 100, 100], maxZoom: 11 }).
A promise that resolves when the zoom operation completes.
Class used to manage created maps
Exports
MapViewer