-
Notifications
You must be signed in to change notification settings - Fork 433
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
The snap on edit mode is sometimes not perfect #715
Comments
What is your Zoom level? |
I reproduce very often it might not be a problem of zoom but calculation of vertex position on the line |
In this code snippet you see that the calculation converts the latlng to a pixel point and then back. leaflet-geoman/src/js/Mixins/Snapping.js Lines 425 to 446 in ff58d54
I didn't found a way to do this with the latlng directly, a PR from you is welcome, else we can't fix this. |
I know this is old, but I'm also running into a similar issue here. I'm performing geo analysis with Turf (https://turfjs.org/) to ensure that my smaller polygons do not extend outside of the bounds of a larger, outer polygon. When I use the snapping feature and the small polygon gets snapped to the larger one, the point at which the smaller is snapped is outside the bounds of the larger polygon according both to Turf and to point-on-line-segment calculations that I accomplished. I've done a workaround using Turf's buffer method (https://turfjs.org/docs/#buffer) where I essentially extend the outer polygon by 2 feet, like so: ` const validate = (zoneLatLngs, sectorLatLngs) => {
} Pulling the point away from the snapped location outside of the polygon validates correctly, given a 2 foot tolerance. |
Hey thanks for your reply but still not sure how do you apply your validate function into the snap function |
When I edit a polygon with a zoom level low and I snap this polygon to another one, it's very common the created snap point is not exactly on the line / point.
For me, it's a problem regarding I control if these polygons are not intersecting.
The text was updated successfully, but these errors were encountered: