leaflet-vectorhats v1.0.0
leaflet-vectorhats
Leaflet-Vecotrhats is a small plugin for leaflet to quickly draw vector hats on polylines for vector visualization.
Installation
TODO: You can use npm to install leaflet-arrowheads:
npm install -leaflet-arrowheads
Usage
Vectorhats can be applied to any polyline, whether unisegmental, multisegmental, continuous, or discontinuous:
var myVector = L.polyline([ coords ]).vectorhats()
Vectorhats will be added to your polyline and will automatically be added to and removed from the map when you call add and remove methods on your polyline:
myVector.addTo(map) or myVector.remove()
If you need to access the vectorhats directly, you can call the .getVectorhats()
method on your polyline.
myVector.getVectorhats() // returns the vectorhats polyline object
myVector.getVectorhats().remove() // removes vectorhats from map
Vectorhats can also be deleted from their parent polyline entirely:
myVector.deleteHats()
Vectorhats can take a configuration object as its argument:
var myVector = L.polyline([ coords ]).vectorhats({ <Options> })
Options
Vectorhats offers a variety of options for rendering and styling vectorhats. See the options table below.
Vectorhats inherit all options from L.Path. Vectorhats also inherit all options from their parent polylines, except fill
, fillOpacity
, and smoothFactor
. These can be changed manually when defining the vectorhats' options, but changing smoothFactor will result in improperly rendered arrows.
Examples
https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#links .
4 years ago