@planet/dynamic-tiles

Support for dynamically colored tiles from Planet Inc. tile servers.

Usage no npm install needed!

<script type="module">
  import planetDynamicTiles from 'https://cdn.skypack.dev/@planet/dynamic-tiles';
</script>

README

Planet Dynamic Tiles

Dynamic tiles are served as numpy tiles. This module has the classes needed to support rendering those tiles inside of OpenLayers.

Developing locally.

After cloning the repository, run build, and use npm link. Example below:

$ npm install
$ npm run build
$ cd dist/
$ npm link
$ cd [to your project]
$ npm link @planet/dynamic-tiles

Including in a project

import {NumpyLayer, NumpySource} from "@planet/dynamic-tiles/ol"

Publishing

Please only publish the dist/ directory.

$ npm publish ./dist/

Worker optimisation

The Layer rendering performance can be improved by using WebWorkers. To use it, the NumpyWorker needs imported the project and passed to the NumpyLayer.

Based on using the webpack worker-loader module.

import NumpyWorker from 'worker-loader!@planet/dynamic-tiles/worker';
...
const numpySource = new NumpySource();
numpySource.set('bands', ['r', 'g', 'b', 'a']);
numpySource.set('dtype', 'uint8');
numpySource.set('pixelDepth', 256);

const numpyLayer = new NumpyLayer({
  source: numpySource,
  workerClass: NumpyWorker,
  style: {
    name: 'rgb',
  },
});

Basic use

A small parcel enabled demo application is included.

npm install
cd demo/
npx parcel ./index.html

You will need a valid URL for an endpoint with NumpyTiles.