Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

leaflet-multi-style

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leaflet-multi-style

quickly add multiple styles to GeoJSON data

  • 1.1.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Leaflet Multi Style

A plugin to quickly add multiple styles to the same GeoJSON data. Demo.

Using

As an extra option, you can add an array of styles instead of just a single style.

var vectorLayer = L.geoJson.multiStyle(geojson, {
    styles: [
        {color: 'black', opacity: 0.15, weight: 10},
        {color: 'white', opacity: 0.8, weight: 8},
        {color: 'red', opacity: 1, weight: 4}
    ],
}).addTo(map);

For point features, the array pointToLayers replaces pointToLayer:

var vectorLayer = L.geoJson.multiStyle(geojson, {
    pointToLayers: [
        function (feature, latlng) {
            return L.circleMarker(latlng, {
                radius: 8.0,
                fillColor: 'yellow'
            })
        },
        function (feature, latlng) {
            return L.circleMarker(latlng, {
                radius: 4.0,
                fillColor: 'red'
            })
        }
    ]
}).addTo(map);

Similarily, there is also an option filters that works just like the original option filter, but is called for each style in styles.

Keywords

FAQs

Package last updated on 14 Jun 2017

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