1.1. Install from CDN
December 1, 2021 ยท View on GitHub
Theory
CDN services are used to embed a script into an HTML page. This makes life easier for developers when creating simple GIS applications.
NextGIS Frontend libraries (NGF) are available via two CDN services: unpkg and jsdelivr
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>
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 systems
Common
We recommend linking to a specific [version] number that you can update manually.
This will help to avoid problems that may occur when updating libraries.
Practice
To run this example, you need to execute these commands in the terminal
npm i
npm start
Afterwards open http://localhost:8080.
If you open the file index.html in the console instead, the work of the example will not be complete. Requests to NGW will fail due to CORS limitations. Server https://demo.nextgis.com is configured to receive requests from http://localhost:8080 and http://127.0.0.1:5500.
This example is also available here
LAUNCH in the codesandbox.io.