Comments (7)
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.
from d3-contour.
Is it possible to add an option to remove the rectangular outer border when it's part of the generated path?
RaumZeit/MarchingSquares.js provided a noFrame
option to remove it.
from d3-contour.
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
The tricky thing is for geographic coordinates
Shameless plug: for spatial contours we can use d3-geo-voronoi’s geoContour.
from d3-contour.
Regarding noFrame
it seems that the solution is to filter out the multipolygons that have exactly 1 polygon with 1 ring with an area equal to n * m - 1/2, like so:
p.coordinates.length === 1 &&
p.coordinates[0].length === 1 &&
2 * d3.polygonArea(p.coordinates[0][0]) === 2 * n * m - 1
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 d3.polygonArea(p.coordinates[0][0]) > n * m - 3/4
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 polygon.sphere
or polygon.isFrame
, leaving the API otherwise unchanged. It can also be left to the user as shown here.
from d3-contour.
Re: "noFrame", I think that returning the area (since we've computed it) as p.area
could be the simplest solution. Beyond "filtering out frames", it can be used to compute stats. (Implemented in #47)
Re: contour simplification, I propose to leave that to topojson.
All in all, closing this issue. Feel free to comment/reopen etc as necessary.
from d3-contour.
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.
from d3-contour.
Yes, #47 was only about the "noFrame" sub-issue.
from d3-contour.
Related Issues (20)
- Release d3-array v2 compatible version? HOT 2
- hole issue in contour HOT 5
- Arrows using elevation value for any point(x, y) in contour chart HOT 5
- GeoJSON Geometry which is generated by d3.contour displays wrong HOT 3
- output data has index which is not exist in input data HOT 2
- Feature request: contour labels HOT 2
- smoothing removes line segements HOT 1
- Buggy input check in density size setter.
- Improve slow computations for large images HOT 2
- Handle Null values in grid HOT 9
- Dependencies HOT 3
- Some contour polygon is reverse. HOT 5
- Support fractional bandwidths. HOT 2
- [feature]: cellSize(0.5) would work well in d3.contourDensity() HOT 1
- Support curvilinear grids HOT 11
- Sometimes the lowest threshold is missing
- Bug HOT 2
- Breaking change with contour-density thresholds starting from v3.0.2 HOT 2
- isobands?
- Don’t round the corners HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from d3-contour.