Fil / d3-geo-voronoi

Voronoi / Delaunay tessellations on the sphere
ISC License
229 stars 24 forks source link

Add GeoJSON test fixture #5

Closed DenisCarriere closed 6 years ago

DenisCarriere commented 6 years ago

Added simple GeoJSON input/output fixture.

Strange output... 🤔

image

image

It says here that extent() is not implemented, so maybe that's the reason why the strange output.

voronoi.extent([extent]) and voronoi.size([size]) are not implemented.

Fil commented 6 years ago

The output you see is weird only because the viewer you use doesn't know how to display these big polygons, that are in the d3 flavor of GeoJSON.

Of course d3 views them perfectly http://blockbuilder.org/Fil/8226c572488d813a4de6dfd50ec5ca50

(Feel free to change d3.geoMercator to some other projection or comment out line 153 to see the global thing).

capture d ecran 2017-10-29 a 21 21 13 capture d ecran 2017-10-29 a 21 20 20
Fil commented 6 years ago

Thank you!

DenisCarriere commented 6 years ago

OOOH I get it! 👍

Yea https://geojson.io might not do the trick for that type of GeoJSON output.

This sounds like it would be pretty tricky to support within TurfJS.

Fil commented 6 years ago

I don't know for turfjs, but in d3 we have antimeridian cutting, which you can get by applying an equirectangular transform, see https://github.com/d3/d3-geo/issues/113#issue-255965427

DenisCarriere commented 6 years ago

Interesting, I remember attempting this in the past and it's not an easy one, feel free to submit a PR if you find a solution for this.