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
  • Import library and application from CDN
  • Set library and application options
  • Display the app in a div
  • Display the map full screen
Exporter en PDF
  1. JMap NG
  2. JMap NG Developer Documentation
  3. Examples

Start the JMap NG App

PrécédentStart the JMap NG Core librarySuivantAdd a JMap NG App extension

Dernière mise à jour il y a 11 mois

You can start JMap NG App in a div of your website, or as a full page application.

Import library and application from CDN

You must import App js files from our CDN links (it will automatically load the JMap Core dependency).

  <script defer type="text/javascript" src="https://cdn.jsdelivr.net/npm/jmap-app-js@7_Kathmandu_HF3"></script>

Make sure the version of the library matches the version of your JMap backend (JMap Cloud or JMap Server).

Set library and application options

You have to provide required and optional parameters to the library and the app:

window.JMAP_OPTIONS = {
  projectId: 1,
  restBaseUrl: "https://jmapdoc.jmaponline.net/services/rest/v2.0",
  anonymous: true,
  map: {
    zoom: 8.468052241302663,
    center: {
      x: -74.049048172276,
      y: 45.53487085859891
    }
  },
  hideMainLayout: true,
  application: {
    containerId: "my-custom-app"
  }
}
}

More information about startup options here

Display the app in a div

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <meta charset="UTF-8">
    <style>
      #my-custom-app {
        position: relative;
        overflow: hidden;
        margin-left: 50px;
        margin-top: 50px;
        width: 850px;
        height: 700px;
        border: 1px solid grey;
      }
    </style>
    <title>JMap NG</title>
  </head>
  <body>
  	<div id="my-custom-app"></div>
    <script type="text/javascript">
      window.JMAP_OPTIONS = {
        projectId: 1,
        restBaseUrl: "https://jmapdoc.jmaponline.net/services/rest/v2.0",
        anonymous: true,
        map: {
          zoom: 8.468052241302663,
          center: {
            x: -74.049048172276,
            y: 45.53583011032552
          }
        },
        hideMainLayout: true,
        application: {
          containerId: "my-custom-app"
        }
      }
    </script>
    <script defer type="text/javascript" src="https://cdn.jsdelivr.net/npm/jmap-app-js@7_Kathmandu_HF3"></script>
  </body>
</html>

Display the map full screen

<!DOCTYPE html>
<html class="jmap_wrapper">
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <meta charset="UTF-8">
    <style>
      html,
      body {
        height: 100%;
        width: 100%;
        margin: 0px;
        padding: 0px;
      }
    </style>
    <title>JMap NG</title>
  </head>
  <body>
    <script type="text/javascript">
      window.JMAP_OPTIONS = {
        projectId: 1,
        restBaseUrl: "https://jmapdoc.jmaponline.net/services/rest/v2.0",
        anonymous: true,
        map: {
          zoom: 8.035870457975536,
          center: {
            x: -74.18791345871016,
            y: 45.55343159305562
          }
        },
        hideMainLayout: true,
      }
    </script>
    <script defer type="text/javascript" src="https://cdn.jsdelivr.net/npm/jmap-app-js@7_Kathmandu_HF3"></script>
  </body>
</html

Try it out in

Try it out in

Codepen.io
Codepen.io
JMap NG App