Giter Club home page Giter Club logo

esri-symbol-renderer's Introduction

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.

esri-symbol-renderer's People

Contributors

underbluewaters avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.