react-leaflet-measure icon indicating copy to clipboard operation
react-leaflet-measure copied to clipboard

React-Leaflet V3

Open abewartech opened this issue 4 years ago • 3 comments

"export 'withLeaflet' was not found in 'react-leaflet'

abewartech avatar Nov 02 '20 07:11 abewartech

is there a solution for V3?

Ethanlloyd21 avatar Mar 01 '21 01:03 Ethanlloyd21

Looking for the solution too

LawrenceWlt avatar Mar 24 '21 09:03 LawrenceWlt

I was able to do it differently.

Add leaflet-measure dependancy.

yarn add leaflet-measure

Import the following:

import * as L from "leaflet"; import 'leaflet-measure'; import 'leaflet-measure/dist/leaflet-measure.css';

On the MapContainer prop whenCreated

whenCreated={(map) => addLeafletMeasureControl(map)}

add the following function.

const addLeafletMeasureControl = (map) =>{ let measureControl = new L.Control.Measure({ position: 'topright', lineColor: 'blue' }); measureControl.addTo(map);

}

It should now work. Hope it helps someone. It could be better if this pluggin was updated. Shalom

LawrenceWlt avatar Mar 24 '21 11:03 LawrenceWlt