Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leaflet 1.9.1 does not include L.GeometryUtil #31

Closed
Concequence opened this issue Sep 27, 2022 · 3 comments
Closed

Leaflet 1.9.1 does not include L.GeometryUtil #31

Concequence opened this issue Sep 27, 2022 · 3 comments

Comments

@Concequence
Copy link

Recently updated to Leaflet 1.9.1 and the L object does not have GeometryUtil, which this package relies on to work.
I could not find a way to get this working without just downgrading Leaflet.

Also do you plan to update this for React 17/18 ?

@slutske22
Copy link
Owner

Hmmmm, I have not tried this with 1.9 yet, but I imagine the removal of the L global in leaflet 1.9 is going to cause alot of problems with tons of plugins in the leaflet ecosystem. The 1.9 release notes do mention

we will provide a shim that can be imported manually that will restore this functionality

Though I have no idea when that will happen. Ultimately this problem is upstream, with leaflet-geometryutil and leaflet itself. But, it does bother me, so there's a pretty simple shim you can do yourself to get this working with leaflet ^1.9

Install leaflet-geometryutil as a dependency of your project

npm i leaflet-geometryutil

When you import 'leaflet-arrowheads', attach GeometryUtil to L yourself:

import L from "leaflet";
import "leaflet-arrowheads";
import GeometryUtil from "leaflet-geometryutil";

L.GeometryUtil = GeometryUtil;

Seems to work fine

codesandbox example

@manzanotti
Copy link

I think they've reversed the change in 1.9.2

Leaflet/Leaflet#8493

@slutske22
Copy link
Owner

Thank goodness

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants