Giter Club home page Giter Club logo

leaflet.mask's Introduction

Leaflet.Mask

Leaflet.Mask is a Leaflet plugin that loading polygons from geojson to masking the rest of the map.

Check out the demo.

Preview

Useage example

var map = L.map("map", {
    center: [29, 120],
    zoom: 8
});
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
    attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);

L.mask('bound.json', {}).addTo(map);

Creation

L.mask(geosjon, options?)
Parameter Type Description
geosjon String|Object .geojson URL or GeoJSON object
options Object Layer options

Options

Option Type Default Description
interactive Boolean false If false, the mask layer will not emit mouse events and will act as a part of the underlying map.
fitBounds Boolean true If true, the map fits the maximum zoom level to the given geographical bounds.
restrictBounds Boolean true If true, the map restricts the view to the given geographical bounds, bouncing the user back if the user tries to pan outside the view.

Options inherited from L.Path

Option Type Default Description
stroke Boolean true Whether to draw stroke along the path. Set it to false to disable borders on polygons or circles.
color String '#3388ff' Stroke color
weight Number 2 Stroke width in pixels
opacity Number 1.0 Stroke opacity
lineCap String 'round' A string that defines shape to be used at the end of the stroke.
lineJoin String 'round' A string that defines shape to be used at the corners of the stroke.
dashArray String null A string that defines the stroke dash pattern. Doesn't work on Canvas-powered layers in some old browsers.
dashOffset String null A string that defines the distance into the dash pattern to start the dash. Doesn't work on Canvas-powered layers in some old browsers.
fill Boolean depends Whether to fill the path with color. Set it to false to disable filling on polygons or circles.
fillColor String '#FFFFFF' Fill color.
fillOpacity Number 1.0 Fill opacity.
fillRule String 'evenodd' A string that defines how the inside of a shape is determined.

leaflet.mask's People

Contributors

ptma 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.