npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cesium-contour

v1.0.2

Published

A Cesium.js contour visualization library for grid data

Readme

English | 中文

Cesium Contour

A grid data contour visualization library for Cesium.js. Uses d3-contour under the hood. You can find more information from Leaflet Contour.

Features

  • Generate contour polygon from grid data
  • Generate contour polyline from grid data Image of polygon pontour Image of polygon pontour

USE

npm install cesium-contour

Quick Start

Display grid data by polygon contour

import { ContourPolygonPrimitive } from "cesium-contour";

const pContour = new ContourPolygonPrimitive({
  gridData: gridData,
  thresholds: 50,
  colorMap: [
    {
      color: "#053061",
      value: 0,
    },
    {
      color: "#eaf1f5",
      value: 0.5,
    },
    {
      color: "#67001f",
      value: 1,
    },
  ],
  min: 10,
  max: 14,
});
viewer.scene.primitives.add(pContour);

Display grid data by polyline contour

const pContour = new ContourPolylinePrimitive({
  gridData: gridData,
  thresholds: 10,
  width: 1,
  colorMap: [
    {
      color: "#053061",
      value: 0,
    },
    {
      color: "#eaf1f5",
      value: 0.5,
    },
    {
      color: "#67001f",
      value: 1,
    },
  ],
  min: 10,
  max: 14,
});
viewer.scene.primitives.add(pContour);

API Reference (Constructor Options)

ContourPolygonPrimitive

| Option | Type | Description | Default | | ------------ | ------------ | --------------------------------------------- | ------- | | gridData | Array | Grid data array | null | | thresholds | Number/Array | Number of contour levels or custom thresholds | 10 | | colorMap | Array | Array of colors for contour levels | [] | | max | Number | Maximum value for normalization | 10 | | min | Number | Minimum value for normalization | 0 |

ContourPolylinePrimitive

| Option | Type | Description | Default | | ------------ | ------------ | --------------------------------------------- | ------- | | gridData | Array | Grid data array | null | | thresholds | Number/Array | Number of contour levels or custom thresholds | 10 | | colorMap | Array | Array of colors for contour levels | [] | | max | Number | Maximum value for normalization | 10 | | min | Number | Minimum value for normalization | 0 | | width | Number | Minimum value for normalization | 1 |

Methods

updateGridData(data)

Update the contour with new grid data

setThresholds(thresholds)

Set new threshold values

setColorMap(colors)

Update the color mapping

Example Data Format

data

Data must be an object {x: [[]], y:[[]], z:[[]]} where x, y, z are 2D arrays of equivalent shape. x: Longitude y: Latitude z: Parameter to display

:warning: Leaflet contour can only be used to disply gridded data, the gridded data must include geographic data beyond the real values (this means at least one layer of surrounding null values). For point data leaflet.heat may be more appropriate.

Example rectangluar gridded data:

| | 8.475 | 8.5 | 8.525 | 8.55 | 8.575 | 8.6 | 8.625 | | --------- | ----- | ---- | ----- | ---- | ----- | ---- | ----- | | 47.42 | null | null | null | null | null | null | null | | 47.4 | null | null | null | 2 | null | null | null | | 47.38 | null | null | 2 | 5 | 2 | null | null | | 47.36 | null | 2 | 5 | 10 | 5 | 2 | null | | 47.34 | null | null | 2 | 5 | 2 | null | null | | 47.32 | null | null | null | 2 | null | null | null | | 47.3 | null | null | null | null | null | null | null |

const data = {
  x: [
      [8.475, 8.5, 8.525, 8.55, 8.575, 8.6, 8.625],
      [8.475, 8.5, 8.525, 8.55, 8.575, 8.6, 8.625],
      [8.475, 8.5, 8.525, 8.55, 8.575, 8.6, 8.625],
      [8.475, 8.5, 8.525, 8.55, 8.575, 8.6, 8.625],
      [8.475, 8.5, 8.525, 8.55, 8.575, 8.6, 8.625],
      [8.475, 8.5, 8.525, 8.55, 8.575, 8.6, 8.625],
      [8.475, 8.5, 8.525, 8.55, 8.575, 8.6, 8.625],
    ],
  y: [
      [47.42, 47.42, 47.42, 47.42, 47.42, 47.42, 47.42],
      [47.4, 47.4, 47.4, 47.4, 47.4, 47.4, 47.4],
      [47.38, 47.38, 47.38, 47.38, 47.38, 47.38, 47.38],
      [47.36, 47.36, 47.36, 47.36, 47.36, 47.36, 47.36],
      [47.34, 47.34, 47.34, 47.34, 47.34, 47.34, 47.34],
      [47.32, 47.32, 47.32, 47.32, 47.32, 47.32, 47.32],
      [47.3, 47.3, 47.3, 47.3, 47.3, 47.3, 47.3],
    ],
  z: [
      [null, null, null, null, null, null, null],
      [null, null, null, 2, null, null, null],
      [null, null, 2, 5, 2, null, null],
      [null, 2, 5, 10, 5, 2, null],
      [null, null, 2, 5, 2, null, null],
      [null, null, null, 2, null, null, null],
      [null, null, null, null, null, null, null],
    ],
};

Development

If you want to develop this project, you can follow the steps below:

# Install dependencies
npm install

# Start development server
npm run dev

# Open browser and navigate to:
http://localhost:5173/example/index.html

# Build for production
npm run build

License

MIT © [wang hua bo]

Issues

Issues and pull requests are welcome.

Contributing

Contributions are welcome! Please read our contributing guidelines before submitting pull requests.