Nietzsche's Preposterous Moustache

    geostyler-openlayers-parser
    TypeScript icon, indicating that this package has built-in type declarations

    3.0.1 • Public • Published

    geostyler-openlayers-parser

    Greenkeeper badge Build Status Coverage Status

    GeoStyler Style Parser implementation for OpenLayers styles

    How to use

    ES6:

    import OpenLayersParser from "geostyler-openlayers-parser";
    import OlLayerVector from "ol/layer/Vector";
    
    const pointSimplePoint = {
      name: "OL Style",
      rules: [
        {
          name: "OL Style Rule 0",
          symbolizers: [
            {
              kind: "Mark",
              wellKnownName: "Circle",
              color: "#FF0000",
              radius: 6
            }
          ]
        }
      ]
    };
    
    const parser = new OpenLayersParser();
    const layer = new OlLayerVector();
    
    parser
      .writeStyle(pointSimplePoint)
      .then(olStyle => layer.setStyle(olStyle))
      .catch(error => console.log(error));

    Browser:

    var pointSimplePoint = {
      name: "OL Style", rules: [{
        name: "OL Style Rule 0",
        symbolizers: [{
          kind: "Mark",
          wellKnownName: "Circle",
          color: "#FF0000",
          radius: 6
        }]
      }]
    };
    var vectorLayer = new ol.layer.Vector();
    var parser = new GeoStylerOpenlayersParser.OlStyleParser(ol);
    parser.writeStyle(pointSimplePoint)
    .then(function(style) {
     vectorLayer.setStyle(style);
    });

    Install

    npm i geostyler-openlayers-parser

    DownloadsWeekly Downloads

    749

    Version

    3.0.1

    License

    BSD-2-Clause

    Unpacked Size

    607 kB

    Total Files

    12

    Last publish

    Collaborators

    • jansule
    • annarieger
    • terrestris-info
    • marcjansen
    • kaivolland
    • dnlkoch
    • ahennr
    • buehner
    • hwbllmnn
    • lukaslohoff
    • mholthausen
    • sgoetsch
    • jorzekowsky
    • simonseyock
    • hblitza
    • jweskamm
    • unraveler
    • chrismayer