-
Notifications
You must be signed in to change notification settings - Fork 18
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
simplifyGeometry() simplifies too much for tolerance=0 #2
Comments
It's how the algorithm works. This person gives a pretty good explanation of how the tolerance parameter works: http://gis.stackexchange.com/a/11915 PostGIS's implementation is roughly the same as mine. Here's test case 1 as a PostGIS call with tolerance at zero: SELECT ST_AsText(ST_Simplify(ST_GeomFromText('MULTIPOLYGON (((-60.501 47.001, -60.323 46.867, -60.317 46.861, -60.311 46.855, -60.305 46.834, -60.606 46.21, -60.606 46.21, -60.605 46.211, -60.6 46.201, -60.736 46.057, -60.501 47.001)))'), 0)); And the output: MULTIPOLYGON(((-60.501 47.001,-60.323 46.867,-60.311 46.855,-60.305 46.834,-60.606 46.21,-60.605 46.211,-60.6 46.201,-60.736 46.057,-60.501 47.001))) Also test case 4 for good measure: SELECT ST_AsText(ST_Simplify(ST_GeomFromText('LINESTRING (45.294 -61.007, 45.294 -61.017, 45.294 -61.027)'), 0)); And the output: LINESTRING(45.294 -61.007,45.294 -61.027) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm working on a project that use your simplifyGeometry function a lot (https://github.com/Wilkins/gpx-simplify-optimizer).
And I found that sometimes with a
tolerance = 0
it simplifies more than it should.I made a little snippet to reproduce my problem :
I guess this is a geometry reason, but I think it should not strip anything if
tolerance=0
.Maybe a simple
if (tolerance === 0) { return points; }
would correct this particular case.But maybe it's a more complex geometry problem that need to be solved for other cases.
The text was updated successfully, but these errors were encountered: