Comments (10)
@mbostock I am very happy to contribute my humble efforts. 😛
from d3-contour.
I think you probably want to reverse the coordinates of the rings, since the GeoJSON polygons generated by d3-contour are planar, while the polygons you want to pass to the orthographic projection are assumed to be spherical; the assumed coordinate system for planar geometry assumes that y points down, while the assumed coordinate system for spherical geometry assumes that y (latitude) points up.
(It’s also possible that there’s a winding order bug in d3-geo for very small polygons, but that should be unlikely given that the size of the polygons here is determined by the size of the pixel grid, and the marching squares algorithm is guaranteed not to generated degenerate polygons.)
But, you haven’t linked to a live example that reproduces the issue, so it’s impossible for me to investigate. When reporting an issue, please include a link to a live example, preferably on bl.ocks.org or RunKit, or as a pull request in the appropriate repository with new unit tests, that demonstrates that the described behavior is not the expected behavior. Use only the minimum amount of code necessary to reproduce the unexpected behavior.
A good bug report should isolate specific methods that exhibit unexpected behavior and precisely define how expectations were violated. What did you expect the method or methods to do, and how did the observed behavior differ? The more precisely you isolate the issue, the faster I can investigate.
Non-actionable bugs may be temporarily closed until you provide additional information. If you can’t isolate the bug any further, please let me know and I will try to help. However, I beg your patience: I must balance your request against many other responsibilities—fixing other bugs, answering other questions, new features, new documentation, etc. Please also consider asking for help on Stack Overflow.
If you have a question about D3’s behavior and want to discuss it with other users, also consider the d3-js Google Group or joining the d3-js Slack.
Thank you! 🤗
from d3-contour.
Thanks for help! I have encountered difficulties to extract an actionable code snippet, since it involves several data and other codes. It would be great if you can guide me to figure out where is wrong.
I have converted the planar coordinates into spherical ones, so it may not be the problem of coordinates? And when used d3.geoPath(d3.geoIdentity())
path, the wrong level above is correct but with upside down and scale not matched. See the following figure, where for the convenience, I have flipped the right panel in Y direction.
So does it mean it is the problems of projection (geoOrthogonal
)?
from d3-contour.
Sorry but I cannot investigate further unless you post code that reproduces the issue. I also suggest taking a look at the d3.geoStitch example linked from the README that demonstrates more generally steps that may be required to convert planar to spherical coordinates; it is not simply a matter of scaling and translating.
from d3-contour.
@mbostock I may have found the cause. In the first figure (thank geojson.io), I spotted a polygon with negative area, which means it should be a hole, but it is outside the main polygon (the biggest one). After delete all the hole polygons, the projected contour has correct fill as shown in second figure. Any idea why this lost polygon is generated?
from d3-contour.
Sorry but I cannot investigate further unless you post code that reproduces the issue.
from d3-contour.
@mbostock I have created an example to show the problem, but I cannot upload binary data to gist
... so I created tar file here. Thanks!
from d3-contour.
I inspected more into the data, and found the data that causes the negative area polygon is as following:
from d3-contour.
@mbostock I think I found a bug in d3-contour
:
holes.forEach(function(hole) {
for (var i = 0, n = polygons.length, polygon; i < n; ++i) {
if (contains((polygon = polygons[i])[0], hole) !== -1) { // This should be compared with -1!
polygon.push(hole);
return;
}
}
});
contains
function return -1
to indicate not-contain situation, but that if
condition pass -1
! When add !== -1
, the contours are correct.
from d3-contour.
Thanks for the test case! I’ve verified your fix in a test and released it as 1.1.1. Here’s a before using your data:
And after:
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 8
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.