-
Notifications
You must be signed in to change notification settings - Fork 24
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
Geo Voronoi polygons out of triangles #11
Comments
You're not doing anything wrong! The reason for the bad display is that D3 doesn't have the same definition of geojson as the others. (See the introduction in https://github.com/d3/d3-geo). In d3-geo, all the lines follow the geodesic lines (great circles), and they don't need to be cut at the antimeridian (longitude=180°). To convert your results to the standard geojson you can use the d3.geoProject utility from https://github.com/d3/d3-geo-projection and do this:
After this operation you should be able to see the features correctly. As you can see if you inspect the resulting structure, one of the polygons has been transformed to a multipolygon, which doesn't make sense from a topological point of view… and that is basically the explanation for this (very inconvenient) difference. We should probably offer a simpler API for this "solution". |
Another reference here: d3/d3-geo#104 |
@Fil many thanks! I've spent a lot of time finding solution. And now I understand the correct approach! |
Hi,
I'm trying to build Voronoi diagram for "infinite horizon" map. The points - are the cities with defined coordinates
[lat, lon]
.Input:
geoJSON
Links
d3.geoVoronoi(geoJSON).links()
Triangles
d3.geoVoronoi(geoJSON).triangles()
Polygons
d3.geoVoronoi(geoJSON).polygons()
Can't understand what I'm doing wrong. I will appreciate any help on these.
The text was updated successfully, but these errors were encountered: