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 🙏

© 2024 – Pkg Stats / Ryan Hefner

esri-symbol-renderer

v1.0.1

Published

Render Esri REST API symbol and renderer objects to canvas for use in legends

Downloads

2

Readme

Renders Esri Renderer and Symbol objects from the REST API to html canvas elements. These can then be used to render custom legends. The goal is to fully support the range of rendering options without relying directly on the Esri JS API. Fully custom legends and table of contents components can be developed without the constraints of the dojo widgets, or even used in conjunction with another mapping API.

Usage

const renderSymbols = require('esri-symbol-renderer');

let options = {
  scale: 2,
  blackFillPatterns: false
};

renderSymbols({ "type" : "classBreaks", ... }, options, (err, items) => {
  for (var legendItem of items) {
    console.log(legendItem);
  }  
});

>> { label: "10.0 - 1000.000000", canvas: <Canvas>}
>> { label: "1000.000001 - 5000.000000", canvas: <Canvas>}
>> { label: "8000.000001 - 10000.000000", canvas: <Canvas>}

Environment

Works in the browser using native apis, and in node via node-canvas. For use in node, you'll need to provide the canvas renderer as an option.

const Canvas = require('canvas-prebuilt');
renderSymbols(json, {canvas: Canvas}, callback);

Options

  • scale can be used to increase the size of the output canvas. Defaults to 1.0. Base scale is 30px to match ArcGIS.com legends.
  • includeDefaultValues will include default symbols for uniqueValue and classBreaks renderers. Defaults to false.
  • blackFillPatterns defaults to true. Fill patterns such as esriSFSForwardDiagonal will not display "correctly" in the Esri JS API. Assuming you are using the Esri API you will want to keep this set to true to match map output. If using anothe rendering method you may want to set to false to get appropriate fill colors.
  • canvas can be set to the node-canvas Canvas constructor for use in node.

Examples

Checkout the playground for renderings of test cases as well as a tool to render services by url.