Comments (9)
It should work. Please make sure the polygon has the expected winding order. https://observablehq.com/@fil/rewind
I'm going to close the issue, but if you think this is a bug, please share the data which triggers it, and I'll reopen.
from d3-geo.
If you rewind it it works
https://observablehq.com/@recifs/dublin-geojson--support
from d3-geo.
Consider fixing the geojson outside your application. If that's not possible, then you should copy 3 cells: geoRewindFeature and its dependencies geoRewindStream and geoProjectSimple. Also make sure you agree with the license (which I had not set yet, now ISC).
from d3-geo.
Thanks for the quick response @Fil, I have tested to make sure the polygon is in the expected winding order by using this GeoJSON linter at https://geojsonlint.com/. It will notify you if you need to rewind the data and also the polygon is displaying correctly on my map and I am not seeing this behavior you described:
Alas when it happens, it’s painful: a shape that represents a tiny speck of land becomes inflated to represent the whole globe minus that tiny speck of land, the map fills with a uniform color, the local projection explodes.
Here is an example of one of the GeoJSON files that does not seem to be working correctly for me: https://gist.github.com/secondl1ght/a902b36dac2379fead3452af49a77973
The same code I wrote is working for other polygons so your theory does make sense that it would be certain GeoJSONs that I am using causing issues. I thought I had it narrowed down to a multipoly issue because those seemed to be the problem ones from when I looked. Maybe you can see if something is wrong with this Dublin file I shared?
Thanks for the help!
from d3-geo.
Wow ok thanks! I guess I should have tested that the polygon drew correctly using D3. I am trying to find your package to use but I don't see it on NPM when I search for @fil/rewind
, do you mind sharing a link to it please?
from d3-geo.
For now it's just a function in a notebook. https://observablehq.com/@fil/rewind
More discussion at #138
from d3-geo.
Thanks, I had a look and it's not super clear to me which part of the code I need to copy over into my app. There is a lot of code there, do I need all of it to complete the rewind that I require?
from d3-geo.
Thanks, is there also a way to check which polygons need to be rewound? I don't want to rewind ones that are already following the required spec.
from d3-geo.
I tried fixing the geojsons outside the application using https://geojsonlint.com/ to check for the 'right-hand rule'. But for some reason the problem GeoJSONs are not being picked up with errors on the lint website but they are still not working with D3.
from d3-geo.
Related Issues (20)
- d3.geoBounds returning confusing output HOT 1
- How can I clamp a geodesic to between a max/min latitude? HOT 1
- fit-test.js Remove duplicate test HOT 1
- Geojson to SVG offset HOT 1
- Geojson to SVG offset
- Cannot import d3-geo in node with typescript HOT 8
- Geographic or Geodetic HOT 1
- D3 uses GeoJSON to represent geographic features in JavaScript HOT 2
- postclip with polygon path maybe... HOT 10
- Error [ERR_REQUIRE_ESM]: Must use import to load ES Module / require() of ES modules is not supported HOT 2
- geoAzimuthalEqualArea not rendering straight lines HOT 2
- clipCircle's precision is too low
- Configurable precision for d3.geoPath
- Mercator. Getting boundary values by longitude HOT 2
- Mercator with rotate. Incorrect conversion from projection to geographic coordinates HOT 3
- Сonvert geographic points considering antimeridian and pole HOT 1
- path.bounds should return numbers even when input coordinates are strings
- [Question] API for chekcing if point is in view or not given projection HOT 3
- Mercator Map centered on the Pacific 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-geo.