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

edward-ol

v1.0.2

Published

Contour-aware path tracing for OpenLayers maps.

Downloads

34

Readme

Edward

Edward is a contour-aware tracing plugin for OpenLayers. It captures the rendered map, extracts image gradients in a worker, and snaps interactive path tracing to visible contours. It was inspired by wanting an OpenLayers equivalent to Annotorious's magnetic outline plugin: https://github.com/annotorious/plugin-magnetic-outline

Install

npm install edward-ol ol

Integrate with OpenLayers

import {Map, View} from 'ol';
import TileLayer from 'ol/layer/Tile';
import OSM from 'ol/source/OSM';
import {createEdwardPlugin} from 'edward-ol';

const map = new Map({
  target: 'map',
  layers: [
    new TileLayer({source: new OSM()})
  ],
  view: new View({
    center: [0, 0],
    zoom: 2
  })
});

const edward = createEdwardPlugin();
edward.apply(map);
edward.enableClickDrawing(map);
edward.setEnabled(true);

If your application already owns a VectorSource, you can inject it so Edward writes committed polygons into your existing editing pipeline:

import VectorLayer from 'ol/layer/Vector';
import VectorSource from 'ol/source/Vector';

const outputSource = new VectorSource();
map.addLayer(new VectorLayer({source: outputSource}));

const edward = createEdwardPlugin({outputSource});
edward.apply(map);
edward.enableClickDrawing(map);

If your app needs to control how the contour worker is created, Edward supports two optional overrides:

  • createWorker: fully custom worker construction
  • workerUrl: provide a module worker URL while keeping Edward's default worker options

Edward resolves them in this order: createWorker, then workerUrl, then the bundled internal worker.

const edward = createEdwardPlugin({
  outputSource,
  workerUrl: new URL('./workers/contour-detection-worker.js', import.meta.url)
});
const edward = createEdwardPlugin({
  outputSource,
  createWorker: () =>
    new Worker(new URL('./workers/contour-detection-worker.js', import.meta.url), {
      type: 'module'
    })
});

Use one of these overrides if your host app needs to guarantee same-origin worker delivery behind a proxy, split dev-server setup, or other non-default asset topology.

Add UI controls

Edward does not render controls for you. The host application is expected to provide its own buttons, selects, and status display, then connect them to the plugin API.

const status = document.createElement('div');
const toggle = document.createElement('button');
const clear = document.createElement('button');
const preset = document.createElement('select');

toggle.addEventListener('click', () => {
  edward.setEnabled(!edward.isEnabled());
});

clear.addEventListener('click', () => {
  edward.clearPoints();
});

preset.addEventListener('change', () => {
  void edward.setSimplificationPreset(preset.value);
});

edward.subscribe((state) => {
  status.textContent = state.status;
  toggle.textContent = state.enabled ? 'Finish trace' : 'Start trace';
  toggle.disabled = state.busy;
  clear.disabled = state.busy || !state.canUndo;
  preset.value = state.activeSimplificationPreset;
  preset.disabled = state.busy;
});

The subscribed state includes status, enabled, busy, canUndo, pointCount, completedPathCount, activeSimplificationPreset, and simplificationPresets.

Local development

To run the demo locally:

npm install
npm start

To build the publishable library:

npm run build

This writes the package entry and worker asset to dist/.