Startup Options

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:

Or pass them as a JS object, through a globally scoped JS variable named JMAP_OPTIONS, like this:

<script type="text/javascript">
    window.JMAP_OPTIONS = {
    projectId: 1,
    restBaseUrl: "",
    anonymous: true,
    map: {
      containerId: "my-custom-map",
      zoom: 9.757829447748511,
      center: {
        x: -73.60243569463414,
        y: 45.504533166207324
      scaleControlVisible: true,
      scaleControlPosition: "top-right"

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

JMap NG Core

The following tables present the list of JMap NG Core library's startup options:

Core options



JavaScript Example

URL Parameter Example


Login as anonymous user

If true, the lib will try to log in as an anonymous user. ()

anonymous: true


true | false

Default Basemap Id

If set, will use the basemap id as default basemap when loading a project. Using "none" will disable any default basemap.()

defaultBasemapId: "mapbox-satellite-streets"



Disable Basemaps

If true, no basemap will be available/displayed. In JMap NG App, no basemap panel will be displayed in the left panel. ()

disableBasemaps: true

ngDisableBasemaps= true

true | false

Disable project change

If true, changing project (after one has been loaded) will be disabled. ()

disableProjectChange: true

ngDisableProjectChange= true

true | false


You can provide your own Core extensions. ()

{ extensions: [ … ] }


json / javascript

Extensions overrides

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. ()

{ extensionsUrlOverride: [ … ] }



Enable/Disable Geolocation

By default, the geolocation is activated (if the browser supports it). You can disable the geolocation by using this option. ()

geolocationEnabled: false

ngGeolocationEnabled =false

true | false

Disable UI visibility

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. ()

hideMainLayout: true


true | false

Session language

If set to any of the locales supported by JMap NG, it will define the session locale, bypassing browser or user-defined locale. ()

locale: “en“



Project thumbnails

If true will load all project thumbnails (base 64 images) asynchronously. ()

loadProjectThumbnails: true



Project id

Id of the JMap project to open. ()

projectId: 12



Project name

Name of the JMap project to open. If both a project id and a project name are provided, project id will be used. ()

projectName: “World“

ngProjectName=The world url encoded => ngProjectName=World


Projects loaded callback

You can provide some JS code to be executed when all project definitions have been loaded from the backend. ()

onProjectsChange: (params) => console.log( params.projects )


javascript function() => void


The Rest API URL of your JMap Server instance. Not used for JMap Cloud. ()

restBaseUrl: “http://your-server/services/rest/v2.0“



Session token

A JMap session token (aka sessionId). If valid, will be used to identify the user. Not used for JMap Cloud. ()

token: “123456789“



Core Map options

Map options are gathered in a "map" json object in the javascript configuration.



JavaScript Example

URL Parameter Example


Map initial bearing

The initial bearing of the map (counterclockwise rotation). ()

map: { bearing: 90 }




Will center the map on the specified point. ()

map: { center: { x: 12.4, y: 45.34 } }



Html container id

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. ()

map: { containerId: “my-div“ }




Will adjust the map to fit the extent. (sw = bbox south-west, ne = bbox north-east) ()

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

By default, the map rotation control is visible, but can be hidden with this parameter. ()

map: { mapRotation ControlVisible: true }

ngMapRotationControl Visible=false

true | false

Google Maps Api Key

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. ()

map: { googleMapsApiKey: “Bse….32k“ }



Mapbox token

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. ()

map: { mapboxToken: “xgb….4f5“ }



Navigation history control visibility

By default, the navigation history control is visible, but can be hidden with this parameter. ()

map: { navigationHistory ControlVisible: true }

ngNavigationHistory ControlVisible=true

true | false

Map ready callback

This function is triggered only once, the first time the map is loaded. ()

map: { onStartupMapReadyFn: map => { console.log(“The map is ready“, map) } }


javascript function(map: mapboxgl.Map) => void

Map initial rotation

The initial rotation of the map (clockwise rotation). ()

map: { rotation: 45 }



Scale-control position

The scale control position on the map. ()

map: { scaleControlPosition: “bottom-right“ }


“top-left” | “top-right” | “bottom-right” | “bottom-left”

Scale-control unit

The scale control unit. ()

map: { scaleControlUnit: “imperial“ }


imperial | metric | nautical

Scale-control visibility

By default, the scale control is visible, but can be hidden with this parameter. ()

map: { scaleControlVisible: true }


true | false


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 wil 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

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

The initial zoom level of the map. ()

map: { zoom: 5.3456 }



Dernière mise à jour

K2 Geospatial 2023