New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mapnik-style-parser

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mapnik-style-parser

Parse JSON data to XML Mapnik Style.

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Mapnik Style Parser

Parse JSON data to XML Mapnik Style.

Installation

Install using the NPM:

npm install -S mapnik-style-parser

Usage Example

A simple use case:

import StyleParser from 'mapnik-style-parser';

StyleParser.toXML({
  attributes: [
    { name: 'background-color', value: 'blue' },
    { name: 'srs', value: '+init=epsg:4326' }
  ],
  styles: [{
    attributes: [{ name: 'name', value: 'My Style' }],
    rules: [{
      name: 'PolygonSymbolizer',
      parameters: [{ name: 'fill', value: '#F2EFF9' }]
    }, {
      name: 'LineSymbolizer',
      parameters: [
        { name: 'stroke', value: 'RGB(50%, 50%, 50%)' },
        { name: 'stroke-width', value: '0.1' }
      ]
    }]
  }],
  layers: [{
    attributes: [
      { name: 'name', value: 'world' },
      { name: 'srs', value: '+init=epsg:4326' }
    ],
    styles: ['My Style'],
    datasource: {
      parameters: [
        { name: 'type', value: 'shape' },
        { name: 'file', value: 'path/to/shapefile.shp' }
      ]
    }
  }]
});

Will produce the XML:

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE Map>
<Map background-color="blue" srs="+init=epsg:4326">
  <Style name="My Style">
    <Rule>
      <PolygonSymbolizer>
        <CssParameter name="fill">#F2EFF9</CssParameter>
      </PolygonSymbolizer>
      <LineSymbolizer>
        <CssParameter name="stroke">RGB(50%, 50%, 50%)</CssParameter>
        <CssParameter name="stroke-width">0.1</CssParameter>
      </LineSymbolizer>
    </Rule>
  </Style>
  <Layer name="world" srs="+init=epsg:4326">
    <StyleName>My Style</StyleName>
    <Datasource>
      <Parameter name="type">shape</Parameter>
      <Parameter name="file">path/to/shapefile.shp</Parameter>
    </Datasource>
  </Layer>
</Map>

License

MIT

Keywords

FAQs

Package last updated on 05 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc