Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Extensions are plug-ins for JMap NG App that extend its functionalities. With the JMap NG API, you can develop your own extensions.
Extensions can add their own UI, typically an icon and a side panel. It is possible to have extensions with a different UI and even with no UI at all.
NG Extensions are javascript objects that respect an interface (either JCoreExtension or JAppExtension) and that are loaded by NG at application startup or project load, depending on the type of the extension. Every extension must have a unique id
property, a initFn
implementation, if implementing JCoreExtension, and a onPanelCreation
implementation if implementing JAppExtension.
Extension life cycle
Extensions are being "registered" by NG in 2 different ways:
if included in the JMap NG startup options, they will be automatically registered by NG.
If loaded from a javascript <script>
tag or via a project load, the extension must register itself. This is typically done in the extension "entry point" by calling the JMap.Extension.register method, for a Core extension, or JMap.Application.Extension.register method, for an Application extension.
The registering process most importantly includes incorporating your extension's redux reducers, if provided, your translation bundle, if provided, and the extension service to expose, if provided.
When NG registers your extension, it automatically calls your extension's initFn
and onPanelCreation
methods. In your initFn
or onPanelCreation
method, you can handle all your extension's initializing process. Once the initFn
method is called, you can start calling NG's API to communicate with it.
Extension unique ID
The Extension Unique ID serves a dual purpose for NG: it used by NG to identifiy and manage the loading process of extensions, while also establishing a connection with a server-side extension. This connection can link your extension to specific JMap projects, optionally allowing for the transmission of configuration data to your extension during project loading. The nature of your unique id thus depends on your way of deploying it.
How to deploy your extension
Once your extension is ready to deploy, you can compile it and host it on any CDN of your choice. If your extension is loaded via a project, the URL of your CDN will be configured in the server-side part of your extension. If you include your extension as a <script>
tag in an HTML page, you will be able to use the CDN's url. In all cases, this url should always be accessible from the location where NG will run.
You can see a full extension example here.
The following pages contain source code examples that you can run or modifiy in Codepen.io.
In all examples, you must import the JMap NG core or app library from our CDN with a command like this:
or
The specific version of the library that you import must match the version of your backend. For JMap Cloud, always use version 'jmapcloud'. For JMap Server, use the version that matches your setup (for instance, 7_Jakarta_HF6 or 7_Kathmandu_HF3). New versions of JMap NG libraries are published for each release of JMap Server.
This manual is for developers who want to use JMap NG to create map visualization applications for the web, integrate mapping capabilities into their web applications or extend existing JMap NG tools. JMap NG connects to your instance of JMap Server and opens JMap projects.
Depending on the needs, one of two different approaches may be selected: using JMap NG Core or using JMap NG App.
Both JMap NG Core and JMap NG App can be easily embedded in you web applications or web sites. This manual explains how to do it and provides running examples that you can use to get started.
JMap NG Core is a library for building map visualization applications for the web. It connects to a JMap Server instance to load and display a map project. It is based on the MapLibre GL JS open source project. It does not include any UI except for the mouseover popups and basic map controls. It is useful when you need only the map but want to build your own UI around it.
JMap NG Core provides a JavaScript API to perform simple tasks and JMap related tasks like getting a JMap Project, managing layers and accessing feature attributes. It also exposes the full MapLibre GL JS API for other tasks.
The latest version of the JMap NG Core Javascript API documentation is available here.
JMap NG App is a complete map visualization application based on JMap NG Core. It provides a complete UI with many ready to use tools such as measuring, selecting, editing features, printing. It does not require any programming but provides a JavaScript API and can be extended by writing JMap NG extensions. JMap NG extensions are modules that plug easily into JMap NG to extend its capabilities, perform custom tasks or to support the integration of JMap NG into another web application.
The latest version JMap NG App Javascript API documentation is available here.
In this example, we will create a custom layer that fetches GeoJSON data from a file. It will display on top of all other layers.
The GeoJSON file for this example is located at this URL: link.
Try it out in Codepen.io
In this example, we will show how to add an event on move end in JMap NG.
We add an event to display the current center of the map. The value is updated each time the move ends.
Try it out in Codepen.io
In this example, we will show how to add one or multiple attributions on the map in JMap NG.
Note that attributions are available in both NG Core and NG App.
In the example bellow, we add a single attribution composed of one hyperlink forwarding to k2geospatial website.
Try it out in Codepen.io
You can add multiple attributions in one call.
In this example, we add two attributions, one composed of a hyperlink forwarding to stackoverflow website and the other composed of a random image forwading to an example domain.
Try it out in Codepen.io
In this example, we will locate and select features on the map, for a given postal code.
In the example dataset, we will use the layer "Places", id=6. We will search on the postal code attribute (CODE_POSTA), and return all places having the given postal code.
Try it out in Codepen.io
You can start JMap NG Core in a div of your website, or as a full page application.
To use the JMap NG Core library, simply import the JMap NG Core Javascript library from our CDN link.
Make sure the version of the library matches the version of your JMap Server instance.
You have to specify options to the library:
More information about startup options here
Try it out in Codepen.io
Instead of running JMap NG Core inside a DIV, you can start it directly in the body of the web page for a full page experience.
Try it out in Codepen.io
You can provide startup options to the JMap NG Core library or the JMap NG App.
Those options let you customize the behaviour of JMap NG at startup.
You can pass those options as URL parameters:
https://jmapdoc.jmaponline.net/services/ng/?ngProjectId=57ec1ca5-ddb8-4c71-ace4-0571129b017c
Or pass them as a JS object, through a globally scoped JS variable named JMAP_OPTIONS, like this:
All options are available as JS parameters, and some are also available as URL parameters. All URL query parameters are prefixed with "ng", to avoid naming collisions with eventual third-party query parameters (especially true if JMap NG is embeded in a div for instance).
The following tables present the list of JMap NG Core library's startup options:
Option
Description
JavaScript Example
URL Parameter Example
Value
Login as anonymous user
anonymous: true
ngAnonymous=true
true | false
Default Basemap Id
defaultBasemapId: "mapbox-satellite-streets"
ngDefaultBasemapId=mapbox-satellite-streets
string
Disable Basemaps
disableBasemaps: true
ngDisableBasemaps= true
true | false
Disable project change
disableProjectChange: true
ngDisableProjectChange= true
true | false
Extensions
{ extensions: [ … ] }
-
json / javascript
Extensions overrides
{ extensionsUrlOverride: [ … ] }
-
json
Enable/Disable Geolocation
geolocationEnabled: false
ngGeolocationEnabled =false
true | false
Disable UI visibility
hideMainLayout: true
-
true | false
Session language
locale: “en“
ngLocale=fr
string
Organization id
organizationId: "my-organization-id"
organizationId="my-organization-id"
string
Project thumbnails
loadProjectThumbnails: true
-
boolean
Project id
projectId: 12
ngProjectId=12
number
Project name
projectName: “World“
ngProjectName=The world url encoded => ngProjectName=World
string
Projects loaded callback
onProjectsChange: (params) => console.log( params.projects )
-
javascript function() => void
Rest API URL
restBaseUrl: “https://api.jmapcloud.io/“
-
string
Session refresh token
token: “v1.MRq[.....]Rehef72YWws“
ngToken=v1.MRq[.....]Rehef72YWws
string
Map options are gathered in a "map" json object in the javascript configuration.
Option
Description
JavaScript Example
URL Parameter Example
Value
Map initial bearing
map: { bearing: 90 }
ngBearing=90
number
Center
map: { center: { x: 12.4, y: 45.34 } }
-
json
Html container id
map: { containerId: “my-div“ }
-
string
Extent
map: { extent: { sw: { x: 12.4, y: 45.34 }, ne: { x: 24.4, y: 55.34} } }
ngExtent=12.48|45.34 |24.4|55.34 url encoded => ngExtent=12.48%7C45.34 %7C24.4%7C55.34
json | string
Rotation control
map: { mapRotation ControlVisible: true }
ngMapRotationControl Visible=false
true | false
Google Maps Api Key
This option is not yet available for JMap Cloud.
If no Google Maps API key is set in the JMap Cloud or JMap Server configuration, you can provide the API key as a JS parameter. The Google Maps API key is not mandatory, but if you don't provide one you won't have access to the Google Maps basemaps. (API doc)
map: { googleMapsApiKey: “Bse….32k“ }
-
string
Mapbox token
map: { mapboxToken: “xgb….4f5“ }
-
string
Navigation history control visibility
map: { navigationHistory ControlVisible: true }
ngNavigationHistory ControlVisible=true
true | false
Map ready callback
map: { onStartupMapReadyFn: map => { console.log(“The map is ready“, map) } }
-
javascript function(map: mapboxgl.Map) => void
Map initial rotation
map: { rotation: 45 }
ngRotation=45
number
Scale-control position
map: { scaleControlPosition: “bottom-right“ }
-
“top-left” | “top-right” | “bottom-right” | “bottom-left”
Scale-control unit
map: { scaleControlUnit: “imperial“ }
-
imperial | metric | nautical
Scale-control visibility
map: { scaleControlVisible: true }
-
true | false
Search
map:{ search: { layerId: 2, attributeName: “PEC“, attributeValue: [“RT 201“, "RT 202"], showMapPopup: true } }
ngSearch=showMapPopup |2|PEC|RT 201|RT 202 url encoded => ngSearch=showMapPopup %7C2%7CPEC %7CRT%20201 %7CRT%20202
json | string
Zoom level
map: { zoom: 5.3456 }
-
number
The following table presents the list of JMap NG App's startup options:
Option
Description
JavaScript Example
URL Parameter Example
Value
Div container id
application: { containerId: “my-app“, … }
-
string
Disable panels
application: { disabledPanels: [ “print“, “mapcontext“ ], … }
ngDisabledPanels= print,mapcontext
Array | string
Extensions
application: { extensions: [ … ] }
-
json / javascript
Login screen background image
application: { loginBackgroundImageUrl: “http://my-server/my-image“, … }
-
string
Logo image
application: { logoImageUrl: “http://my-server/my-image“, … }
-
string
App loaded callback
application: { onAppLoad: () => console.log(“App is loaded“), … }
-
javascript function() => void
App unloaded callback
application: { onAppUnload: () => console.log(“App is not loaded anymore“), … }
-
javascript function() => void
Display a panel
application: { panel: “query“, … }
ngPanel= selection
"layer" | "selection" | "measure" | "mapcontext"| "print" | "user" | "query" | "annotation" | "geometry"
Project list background image
application: { projectBackgroundImageUrl: “http://my-server/my-image“, … }
-
string
Initial side panel visibility
application: { sidePanelInitialVisibility: false, … }
ngSidePanelInitialVisibility= false
true | false
Theme
application: { theme: “light“, … }
ngTheme=light
light | dark
JMap NG extensions are plug-in modules taht can exetend the functionalities present in JMap NG App. You can develop and add your own extensions.
For more information about JMap NG extensions, refer to this section.
The JMap NG App extension API documentation is available here.
The example bellow shows a simple extension that creates a panel and displays some text on it.
Try it out in Codepen.io
There is another way to load your extension, after the JMap NG App has been loaded.
You can register the previous extension like this:
The example bellow shows you a more sophisticated extension named "Favourite locations".
It adds points on the map where you click, and displays a list of your "favourite" locations. You can also toggle the visibility of the point layer.
Try it out in Codepen.io
If true, the lib will try to log in as an anonymous user. ()
If set, will use the basemap id as default basemap when loading a project. Using "none" will disable any default basemap.()
If true, no basemap will be available/displayed. In JMap NG App, no basemap panel will be displayed in the left panel. ()
If true, changing project (after one has been loaded) will be disabled. ()
You can provide your own Core extensions. ()
During the development of a project extension, you can use this option to load your local code instead of the project's extension's jsUrl. ()
By default, the geolocation is activated (if the browser supports it). You can disable the geolocation by using this option. ()
If set to true, NG Core will not display a basic UI providing loading progress information, a login form and a project list. By default, this option is disabled in NG App. ()
If set to any of the locales supported by JMap NG, it will define the session locale, bypassing browser or user-defined locale. ()
The JMap Cloud organization id. Used when passing a session refresh token (see below). ()
If true will load all project thumbnails (base 64 images) asynchronously. ()
Id of the JMap project to open. ()
Name of the JMap project to open. If both a project id and a project name are provided, project id will be used. ()
You can provide some JS code to be executed when all project definitions have been loaded from the backend. ()
The Rest API URL of your JMap Server instance. ()
A JMap Cloud refresh token used to initiate a session. If valid, will be used to identify the user. )
The initial bearing of the map (counterclockwise rotation). ()
Will center the map on the specified point. ()
You can place the map in the HTML div of your choice by identifying the div in the map parameter. If not set, a div is appended in the body root. ()
Will adjust the map to fit the extent. (sw = bbox south-west, ne = bbox north-east) ()
By default, the map rotation control is visible, but can be hidden with this parameter. ()
If no Mapbox access token is set in the JMap Cloud or JMap Server configuration, you can provide the token as a JS parameter. The Mapbox token is not mandatory, but if you don't provide one you won't have access to the Mapbox basemaps. ()
By default, the navigation history control is visible, but can be hidden with this parameter. ()
This function is triggered only once, the first time the map is loaded. ()
The initial rotation of the map (clockwise rotation). ()
The scale control position on the map. ()
The scale control unit. ()
By default, the scale control is visible, but can be hidden with this parameter. (
When the map is loaded, will execute a search by attribute(s) on the layer, and zoom to the matching features. You can search using multiple attribute values by passing an array in the javascript form, or by passing trailing values in the URL form. An optional parameter lets you specify to display a MouseOver popup on the result feature. This popup will only be displayed if the showMapPopup parameter is true, and if there is only one result to the search. In the URL form, showMapPopup must be passed as a keyword, and at the beginning of the query string ()
The initial zoom level of the map. ()
You can choose the div where the application (and the map) will be rendered in your page. ()
Will disable (and hide) the specified panels. ()
You can provide your own application extensions . See the examples section for details. ()
You can set a custom background image for the login screen by setting an image url. This image will be displayed to the left of the JMap NG login form. ()
You can set a custom logo image by setting an image url. The logo will be displayed above the JMap NG login form. ()
You can provide JS code that will be executed when the app is ready. ()
You can provide JS code that will be executed when the app is unloaded. ()
Will show the specified panel at startup. ()
You can set a custom background image for the project list screen by setting an image url. This image will be displayed to the left of the project list. ()
Controls side panel initial visibility. ()
Will set the theme, dark or light. ()
In this example, we will locate and select a feature on the map, for a given feature id.
In the example dataset, we will use the layer "Places", id=6, and locate feature with id=33.
We expect to find this feature, select it, then recenter the map around it.
Try it out in Codepen.io
This example shows how to create a custom form. It instantiates a JMap NG App extension that creates a custom form in a panel.
Form UI is only available in JMap NG App, and not in JMap NG Core.
Try it out in Codepen.io
In this example, we will locate and select a feature on the map for a given location and on any selectable layer.
The default coordinates will select a feature on layer "Places", id=6.
Try it out in Codepen.io
JMap Cloud NG is a fork of the first generation of JMap NG that was the official JMap Server/JMap Cloud web client up until JMap Server Kathmandu.
JMap Cloud NG is the official NG Client for JMap Cloud. JMap Cloud NG is only compatible with JMap Cloud. All JMap Server specific capabilities of JMap Cloud NG have been removed after the fork from JMap NG (first generation).
Allow creating Thematics on-the-fly. It is now possible to add a custom Style Rule (Thematic) to an existing layer in NG for JMap Cloud. A detailed example is available here. This thematic is only available during the current session, it is not persisted.
Mew API methods:
JMap.Layer.Thematic.addThematic(params)
JMap.Layer.Thematic.deleteThematic(layerId, thematicId)
(delete any thematic, client-side, for the current session only)
JMap.Map.resetSelectionStyle()
, a new API method to reset the selection style of a layer that was previously modified with JMap.Map.setSelectionStyle()
New options for API method JMap.Application.Print.takeCapture
:
(... ,customRatioWidth, customRatioHeight)
lets specify a custom aspect ratio for the generated image
Measurements panel; error when selecting Nautical Miles as the unit for an area measure
Fix several problems with dynamic filters when working with Date or DateTime attributes
Support snapping on layer elements in all draw environments (feature creation, measures, annotations)
New API methods:
JMap.Feature.getByLayerId(layerId, bbox)
(retrieves features from a layer)
JMap.Application.Annotation.setSnapEnabled(enabled)
JMap.Application.Annotation.setSnapLayerId(layerId)
JMap.Application.Geometry.setSnapEnabled(enabled)
JMap.Application.Geometry.setSnapLayerId(layerId)
JMap.Application.Measure.setSnapEnabled(enabled)
JMap.Application.Measure.setSnapLayerId(layerId)
make JMap.Application.Print.takeCapture
return a data URL instead of triggering a browser download
modified API method: JMap.Application.Print.takeCapture(returnAsDataUrl)
Added the JMap.Map.setSelectionStyle()
method to set the selection style of a layer. Allows developer to change the selection style of a layer see this page for details
fix problem when calling JMap.Feature.getByIds
with too many IDs
fix problem when calling JMap.Layer.Search.byAttribute
with too many attribute values
Unable to use ''Ctrl+V'' with a numeric value in a dynamic filter on a layer
ngExtent
url startup param is not working anymore
Measure panel doesn't scroll
fix marker registration when creating a new point feature in geometry creation panel
JMap.Layer.attributeExists()
does not work
Export selection as Excel file is broken
Layer names in selection panel are visible when they overflow the panel's width
"Recenter the Map" widget does not work properly
The last character of the result of the substring function is missing in the mouseover.
New CRS support refactoring:
Modified API methods:
JMap.Projection.reprojectLocation()
is now asynchronous
JMap.Projection.reprojectBoundaryBox()
is now asynchronous
Removed API methods:
JMap.Map.isLayerRendered()
has been removed
JMap.Map.getLayersVisibilityStatus()
has been removed
JMap.Map.getLayersVisibilityStatusAsArray()
has been removed
JMap.Map.getRenderedJMapLayerIds()
has been removed
Improve mouseover display
Add support for JMap Cloud Simple Search feature
JMap Cloud now supports a global search mechanism for finding information in any indexed patial data sources or in a whole project through all its indexed spatial data sources (/rest/v1/organizations/{organization}/spatialdatasources/{spatialdatasource}/search
and /rest/v1/organizations/{organization}/projects/{project}/search
)
Added API methods:
JMap.SimpleSearch.setQueryString(queryString: string)
JMap.SimpleSearch.getMinimumQueryStringLength()
JMap.SimpleSearch.getInvalidQueryStringCharacters()
New API events:
JMap.Event.SimpleSearch.on.success
JMap.Event.SimpleSearch.on.error
Add support for 3D DEM
When opening a project that has an associated DEM file, the DEM is displayed on the map
New API methods:
JMap.Map.isTerrainAvailable()
JMap.Map.isTerrainActive()
JMap.Map.setTerrainActive(active:boolean)
let the user choose between EPSG:4326 (Lat-Lon) and the project’s CRS for the mapInfo widget coordinates
Error calculating extent for a WMTS service
Mouseover horizontal scrollbar appears for nothing
Modify UI to ask for current password when changing password
Login page, problem entering Username and Password fields
Problem downloading map captures from the Exportation / Print Tool section (with MapLibre)
An hyperlink in an attribute doesn’t work in the mouseover
JMap.Feature.getByIds() method doesn’t display retrieved features on the map
Unable to sort columns in attribute table for selected features
Problems interpreting dates in string (ISO)
Removed Thematic Legend Title and Legend Subtitle from UI
Open JMap Cloud NG with an URL using ngSearch
query param does not work
Removed conditional logic in JMap Cloud NG for switching between JMap Cloud and JMap Server
Removed API methods:
JMap.Server.getType()
JMap.Server.isSaas()
JMap.Server.isLegacy()
JMap.Server.getMinimumVersion()
Modified API methods:
JMap.Feature.deleteByIds()
now returns a Promise<JId>
instead of a Promise<GeoJSON.Feature>
removed/renamed/modified types/enums/interfaces:
removed JSERVER_TYPES
renamed JSERVER_SAAS_STATUS
to JSERVER_STATUS
renamed JServerSaasService
to JServerService
renamed JServerSaasServiceById
to JServerServiceById
JJMapCloudPasswordPolicyCompliance
removed JMinimumServerVersion
removed title
and subTitle
from JLayerThematic
JJMapCloudPasswordPolicyCompliance
renamed to JJMapPasswordPolicyCompliance
removed refreshToken
from JTokenInfo
The mouseover is a popup window that is displayed after clicking on features on the map.
If no mouseover content is set in the layer configuration, no popup is displayed when clicking on a feature of that layer.
You can set your own mouseover content programatically in Javascript. For instance, you can add a mouseover on a layer that has no mousoever content in its configuration.
In the following example, the layer "Hydrography", id=3, has no mouseover defined.
We will set a custom mouseover content that:
Always displays a custom header
Displays the mouseover content for a clicked hydrography feature
Avoids displaying a mouseover for the "Event" layer (blue dots on the map)
Always displays a custom footer
Try it out in Codepen.io
You can start JMap NG App in a div of your website, or as a full page application.
You must import App js files from our CDN links (it will automatically load the JMap Core dependency).
Make sure the version of the library matches the version of your JMap backend (JMap Cloud or JMap Server).
You have to provide required and optional parameters to the library and the app:
More information about startup options here
Try it out in Codepen.io
Try it out in Codepen.io