react-leaflet-multi-options-polyline

3.0.10 • Public • Published

react-leaflet-multi-options-polyline

Provides a React component to enable multiple styles for a polyline in a react-leaflet map. Based on Leaflet.MultiOptionsPolyline by hgoebl.

Demos

To see demos page run on terminal:

yarn install and then yarn start

Usage

import React from 'react';
import { MapContainer, TileLayer } from 'react-leaflet';
import ReactLeafletMultiOptionsPolyline from '../../';

export default function DataMap ({positions, optionIdxFn, options}) {
    return (
        <MapContainer
            style={{height: '40%'}}>
                <TileLayer
                    attribution='&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
                    url="https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png"
                />
                <ReactLeafletMultiOptionsPolyline
                    positions={positions}
                    optionIdxFn={optionIdxFn}
                    options={options}
                    weight={5}
                    lineCap='butt'
                    opacity={0.75}
                    smoothFactor={1}
                    zoomAnimation={false}
                />
        </MapContainer>
    )
}

Package Sidebar

Install

npm i react-leaflet-multi-options-polyline

Weekly Downloads

41

Version

3.0.10

License

ISC

Unpacked Size

11.3 kB

Total Files

5

Last publish

Collaborators

  • ponchox