JMap Cloud
English
English
  • Welcome to JMap Cloud documentation
  • JMap Cloud Portal
    • JMap Cloud Portal User Guide
      • Introduction
        • Accessing JMap Cloud Portal
        • User Interface
        • Dashboard
      • Roles
      • Functions Reserved for Administrators
        • Managing the Organization
          • General
          • API Keys
          • Members
          • Invitations
      • Connecting Data: Data Sources
        • Creating Data Sources
          • Vector/Raster Data Files
          • Non-spatial tabular data files
          • WMS/WMTS Service
          • Vector Tile Service
          • Feature Service
        • Status of a Data Source
        • Managing Data Sources
          • Displaying and editing information
          • Updating data
          • Permissions
          • Removing a spatial data source
        • Uploading Files
      • Organizing Data into Projects
        • Creating a New Project
        • Managing a Project
          • Open the Project
          • Editing a project
          • Permissions
          • Getting the project's public link
          • MVT Cache
          • Deleting the project
      • Configuring Project Content
      • Jobs
  • JMap NG
    • JMap NG User Guide
      • Introduction
        • Connecting to JMap NG
        • User Interface
        • Navigating on the Map
        • Profile and user settings
      • The Data
        • The Layers Panel
        • Data Layers
          • Displaying layers
          • Thematics
          • Layer Information
          • Geographic Extent of the Layer
          • Making layer elements selectable
      • I Wish to...
        • Display Element Information
        • Select Elements on the Map
        • Measure Distances and Surfaces
        • Add Annotations to the Map
        • Export / Print a Map
    • JMap NG Developer Documentation
      • Startup Options
      • Extensions
      • Examples
        • Start the JMap NG Core library
        • Start the JMap NG App
        • Add a JMap NG App extension
        • Toggle a JMap layer visibility
        • Add a layer to display custom data from GeoJSON file
        • Locate and select features by attribute query
        • Add an event on move end
        • Add attributions on the map
        • Locate and select feature by id
        • Locate and select feature(s) by location
        • Custom mouseover on a layer
        • Create a custom form in a div
      • Changelog
  • JMap Cloud API
    • JMap Cloud API Documentation
  • JMap Cloud Plugin for QGIS
    • JMap Cloud Plugin User Guide
      • Installing the plugin
      • Connecting to JMap Cloud
      • Opening a project
      • Editing features
      • Exporting a project
Propulsé par GitBook

K2 Geospatial 2023

Sur cette page
  • JMap NG Core
  • Core options
  • Core Map options
  • JMap NG App
Exporter en PDF
  1. JMap NG
  2. JMap NG Developer Documentation

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:

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:

<script type="text/javascript">
    window.JMAP_OPTIONS = {
    projectId: "57ec1ca5-ddb8-4c71-ace4-0571129b017c",
    restBaseUrl: "https://jmapdoc.jmaponline.net/services/rest/v2.0",
    anonymous: true,
    map: {
      containerId: "my-custom-map",
      zoom: 9.757829447748511,
      center: {
        x: -73.60243569463414,
        y: 45.504533166207324
      },
      scaleControlVisible: true,
      scaleControlPosition: "top-right"
    }
  }
</script>

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

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

Legacy authentication

If set to true, will revert to a REST API-based authentication setup

legacyAuthentication: true

ngLegacyAuthentication=true

boolean

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

Core Map options

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 }

ngScaleControlVisible=false

true | false

Map Info-control visibility

map: { mapInfoControlVisible: true }

ngMapInfoControlVisible=false

true | false

Terrain-control visibility

map: { terrainControlVisible: true }

ngTerrainControlVisible=false

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

JMap NG App

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

Simple Search control visibility

application: { simpleSearchControlVisible: false, … }

ngSimpleSearchControlVisible=false

true | false

Geocoding control visibility

application: { geocodingControlVisible: false, … }

ngGeocodingControlVisible=false

true | false

Theme

application: { theme: “light“, … }

ngTheme=light

light | dark

PrécédentJMap NG Developer DocumentationSuivantExtensions

Dernière mise à jour il y a 5 jours

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. ). Using this option will automatically activate the legacy authentication.

The initial bearing of the map (counterclockwise rotation). (). This option is overridden by the extent option

Will center the map on the specified point. (). This option is overridden by the extent option

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) (). This option has precedence over the following options: bearing, center, rotation and zoom

By default, the map rotation control is visible, but can be hidden with this parameter. (). This option is overridden by the extent option

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

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

By default, the Terrain 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. (). This option is overridden by the extent option

You can choose the div where the application (and the map) will be rendered in your page. ()

Will disable (and hide) the specified panels. Specifying "all" will hide all panels and remove the side menu ()

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. (). Only effective when using legacy authentication

You can set a custom logo image by setting an image url. The logo will be displayed above the JMap NG login form. (). Only effective when using legacy authentication

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

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

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

Will set the theme, dark or light. ()

API doc
API doc
API doc
API doc
API doc
API doc
API doc
API doc
API doc
API doc
API doc
API doc
API doc
API doc
API doc
(API doc
API doc
API doc
API doc
API doc
API doc
API doc
API doc
API doc
API doc
API doc
API doc
API doc)
API doc
API doc)
API doc
API doc
api doc
api doc
api doc
api doc
api doc
api doc
api doc
api doc
api doc
api doc
API doc
API doc
api doc