Skip to content

wegaw/defrost-examples

Repository files navigation

DeFROST Code Examples

Demonstrates integration of DeFROST Snow Cover tiles and API in supported platforms:

  • OpenLayers 5.3, Leaflet 1.5, Mapbox GL JS 1.2 and Google Maps JS API V3 for displaying snow cover tiles
  • JavaScript, Python and Curl for API requests

The test web app can be launched using npm.

Getting started

Setup your JWT Access and Refresh Tokens in the .env.defaults file. You can get them from DeFROST Account Dashboard. For the Mapbox GL JS example to work, you also need to set your Mapbox access token.

# .env.deaults, safe to commit
JWT_ACCESS_TOKEN=<YourJWTAccessTokenHere>
JWT_REFRESH_TOKEN=<YourJWTRefreshTokenHere>

DEFROST_MAPS_URL=https://maps.defrost.io/{z}/{x}/{y}.png
TOKEN_REFRESH_URL=https://api.defrost.io/v1/token/refresh/

MAPBOX_TOKEN=<YourMapboxTokenHere>

Launching the test app

When ready, install dependencies and run the app with the following commands:

npm install
npm run start:dev

This will trigger JavaScript hot bundle compilation using webpack. Once the Compiled successfully message appears on your terminal, access the app at localhost:8080 from your browser.

The test web application demonstrates DeFROST Snow Cover tiles integration, as well as making an API request using JavaScript. For the Python and Curl API tests, launch the files directly with your Python interpreter or from your terminal.

License

About

[DEV WEB] Code samples that demonstrate how to integrate DeFROST services in different platforms.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published