A suite of frontend JavaScript libraries designed to accelerate the development of web-GIS applications using NextGIS software and services as a backend. NextGIS Frontend supports three major open-source GIS frameworks with unified interfaces.
@nextgis/[package-name]
Single-file bundles for rapid deployment of web-gis applications with NextGIS services
Bricks for build custom Web GIS frontend
Map-free libraries to interaction with NextGIS Web
Map-free tools for common purpose
Explore how NextGIS frontend libraries are utilized in actual projects:
Download and include with a script tag. [Package] will be registered as a global variable.
<script src="./lib/[package].global.js"></script>
<script>
var package = new Package(options);
</script>
<script type="module">
import Package from 'https://unpkg.com/@nextgis/[package]/lib/[package].esm-browser.prod.js';
</script>
Choose between unpkg
:
<script src="https://unpkg.com/@nextgis/[package]"></script>
<script src="https://unpkg.com/@nextgis/[package]@[version]"></script>
<script src="https://unpkg.com/@nextgis/[package]@[version]/lib/[file]"></script>
and jsdelivr
<script src="https://cdn.jsdelivr.net/npm/@nextgis/[package]"></script>
<script src="https://cdn.jsdelivr.net/npm/@nextgis/[package]@[version]/lib/[file]"></script>
[file]
- [package].[format].prod.js
[format]
:
global
- browser scriptcjs
- node moduleesm-browser
- browser moduleesm-bundler
- module for bundler systemsWe recommend linking to a specific [version]
number that you can update manually
npm install @nextgis/[package]
then import the [package] in the project modules
import Package from '@nextgis/[package]';
// or
import { Component, utility } from '@nextgis/[package]';
const package = new Package(options);
import { NgwMap } from '@nextgis/ngw-map';
import './leaflet-style-override.css';
import MapAdapter from '@nextgis/leaflet-map-adapter';
// OR
// import 'ol/ol.css';
// import MapAdapter from '@nextgis/ol-map-adapter';
// OR
// import 'maplibre-gl/dist/maplibre-gl.css';
// import MapAdapter from '@nextgis/maplibre-gl-map-adapter';
const ngwMap = new NgwMap(new MapAdapter(), {
target: "map",
qmsId: 448,
baseUrl: "https://demo.nextgis.com",
resources: [2011, { resource: 222, fit: true }, { resource: "keyname" }],
});
ngwMap.onLoad().then(() => {
// do something
});
// from resource id
ngwMap.addNgwLayer({ resource: 2011 });
// by keyname
ngwMap.addNgwLayer({ resource: "keyname" });
// add vector layer from style resource
ngwMap.addNgwLayer({ resource: "style_keyname", adapter: "GEOJSON" });
// add first style from vector resource (if available)
ngwMap.addNgwLayer({ resource: "vector_keyname", adapter: "TILE" });
The resource
can be id or keyname.
Examples
Add different NextGIS Web resource
First install Yarn
# Clone git through ssh
git clone git@github.com:nextgis/nextgis_frontend.git
cd ./nextgis_frontend
# Install dependencies
yarn install
# Prepare packages
yarn run bootstrap
# Build all packages
yarn run prod
# Build demo app
yarn run demo
To copy the pages of universal examples from the demo/examples into the corresponding examples of frontend libraries run
yarn run examples
# Go to package directory (for example webmap)
cd ./packages/webmap
# Run build command
yarn run dev
# or
yarn run prod
# Run watch source files changes command
yarn run watch
Before publishing you should execute prod
script
lerna run prod
To publish new version to git and npm run
lerna publish
When publishing, you will need to select a new version number. It is the same for all libraries. Dependencies between packages are solved automatically.
To publish a new package, run the following command in the package folder
npm publish --access=public
The tests are launched from the root project directory. Testing is performed for all packages.
npm t # run all test with coverage
npm run karma # run karma test in watch mode for development
Need to fix a bug or add a feature to NextGIS Frontend? We provide custom development and support for this software. Contact us to discuss options!