Socket
Socket
Sign inDemoInstall

cesium-mvt-imagery-provider

Package Overview
Dependencies
45
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cesium-mvt-imagery-provider

Custom ImageryProvider for mapbox vector tile


Version published
Maintainers
2
Created

Readme

Source

cesium-mvt-imagery-provider

Usage

npm

npm i cesium cesium-mvt-imagery-provider
import { Viewer } from "cesium";
import CesiumMVTImageryProvider from "cesium-mvt-imagery-provider";

const imageryProvider = new CesiumMVTImageryProvider({
  urlTemplate: "http://localhost:8080/sample_mvt/{z}/{x}/{y}.mvt",
  layerName: "layerName", // or "layerName1,layerName2,layerName3"
  style: feature => {
    return {
      strokeStyle: "green",
      fillStyle: "green",
      lineWidth: 1,
    };
  },
  onSelectFeature: feature => {
    console.log("Feature is selected");
  },
  credit: "cesium.js",
});

const layers = viewer.scene.imageryLayers;
const currentLayer = layers.addImageryProvider(imageryProvider);
currentLayer.alpha = 0.5;

// Call `layers.remove(currentLayer);` when it is unnecessary.

See example directory for more details.

Development

  1. yarn
  2. yarn unlink && yarn build && yarn run link
  3. cd ./example
  4. yarn && yarn dev
  5. Then example cesium application is started

If you run example, you need to set sample MVT data to ./example/public. And you should change layerName option for MVTImageryProvider in ./example/src/Imagery.tsx.

FAQs

Last updated on 07 May 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc