-
Notifications
You must be signed in to change notification settings - Fork 63
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
Option to remove points along straight lines? #14
Comments
The tricky thing is that for geographic coordinates (as in GeoTIFF Contours II) we want to retain the intersecting points along the antimeridian, which may not be possible if we eliminate all the straight line points. Also, parallels are not great arcs, so removing these points changes the interpretation in spherical coordinates. |
Is it possible to add an option to remove the rectangular outer border when it's part of the generated path? |
Contour simplification could be an option of d3-contour, but I believe it's enough to leave this to topojson as in https://observablehq.com/d/4fe65b865ccf545d
Shameless plug: for spatial contours we can use d3-geo-voronoi’s geoContour. |
Regarding
The solution works both with smoothed/non smoothed contours. It seems to work for all n, m but we can fortify it against calculation drift by testing The test is fast enough (exits immediately on most polygons, and 2*area is computed anyway), so it could be added at no cost as a property to the polygons as a property |
It can be used, for example, to filter out "frames", i.e. the whole rectangle returned for a value < min(values), by testing geometry.area > n * m - 3/4 https://observablehq.com/d/0cef46faf6b9c53c See #14
Re: "noFrame", I think that returning the area (since we've computed it) as Re: contour simplification, I propose to leave that to topojson. All in all, closing this issue. Feel free to comment/reopen etc as necessary. |
I don’t think #47 is sufficiently helpful here: the points along straight lines occur not only when a contour polygon covers the entire frame, but whenever any contour polygon abuts the frame. In other words the darker blue polygons in the #47 example also have many points along straight lines that could be removed. I think what I want here is to detect perfectly horizontal (x1 === x2) or perfectly vertical (y1 === y2) line segments and remove the extraneous intermediate points. But per #14 (comment) this should be optional. |
Yes, #47 was only about the "noFrame" sub-issue. |
We currently emit one point per pixel in the grid, which leads to many extra coordinates along straight edges. For example this:
Could be reduce to this:
The text was updated successfully, but these errors were encountered: