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-pip is not working with Leaflet-draw plugin #27

Open
fab-girard opened this issue Jun 13, 2017 · 0 comments
Open

Leaflet-pip is not working with Leaflet-draw plugin #27

fab-girard opened this issue Jun 13, 2017 · 0 comments

Comments

@fab-girard
Copy link

Hello,
I've tried to update my app with leaflet 1.0.x and I'm facing up to an incompatibility between 2 plugins:

Since this commit in leaflet-pip, function is_poly is not anymore able to take into account polygons just created with leaflet-draw. I thought leaflet-draw created an incorrect polygon in this issue but I suspect now leaflet-pip is maybe not enough permissive.
I would suggest a PR which updates the is_poly function from your plugin:

function isPoly(l) {
    if (l instanceof L.Polygon) return true;
    return l.feature && l.feature.geometry && l.feature.geometry.type &&
        ['Polygon', 'MultiPolygon'].indexOf(l.feature.geometry.type) !== -1;
}

Indeed layer created by leaflet-draw has no l.feature && l.feature.geometry && l.feature.geometry.type attribute...

And maybe rollback entirely ff2b2f4 for is_poly:

function isPoly(l) {
    return L.MultiPolygon && l instanceof L.MultiPolygon ||
        l instanceof L.Polygon ||
        l.feature && l.feature.geometry && l.feature.geometry.type &&
        ['Polygon', 'MultiPolygon'].indexOf(l.feature.geometry.type) !== -1;
}

What do you thinking about it ?

Fabien

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

1 participant