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
Sur cette page
Exporter en PDF
  1. JMap NG
  2. JMap NG Developer Documentation

Extensions

PrécédentStartup OptionsSuivantExamples

Dernière mise à jour il y a 3 mois

K2 Geospatial 2023

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.