Coder Social home page Coder Social logo

Overlapping Voronoi polygons about d3-geo-voronoi HOT 6 OPEN

fil avatar fil commented on May 23, 2024
Overlapping Voronoi polygons

from d3-geo-voronoi.

Comments (6)

Fil avatar Fil commented on May 23, 2024 1

I believe this shows two distinct issues:

  1. when we have 2 columns (and whatever the number of rows), geoVoronoi returns ill-defined polygons.

  2. when you request more than two columns, the polygons are OK, but d3.geoEquirectangular (and, it seems, all the projections that rely on antimeridian clipping) fail to display them properly. (You can see that by switching to d3.geoAzimuthalEqualArea in your notebook.)

from d3-geo-voronoi.

Fil avatar Fil commented on May 23, 2024 1

With "2 columns", the points are in fact collinear (all belong to the great circle that passes through the poles and [-90;0]). It's one of these situations where the (planar) Delaunay triangulation also tends to fail.

A "solution" in that case can be to introduce a supplementary point that is very close to the first point, but not aligned on the same grand circle. (It's frustrating that the code can't compute this case on its own, tho.)

from d3-geo-voronoi.

duynguyen158 avatar duynguyen158 commented on May 23, 2024

Yes. Adding the supplementary point works. Thanks @Fil!

In my original use case, I had a gridded dataset of more than 2 columns, and I took up d3.geoEquirectangular because it didn't seem like it was stretching/squeezing Vietnam, the country I wanted to visualize, by a whole lot (though I hadn't given that a lot of thought and could be totally wrong). What would you recommend as a replacement for geoEquirectangular?

from d3-geo-voronoi.

Fil avatar Fil commented on May 23, 2024

It's hard to give a generic recommendation for a projection, it depends so much on the total area you're interested to show (the world or the region), and on the features that are the focus of interest.

Sometimes you will want to follow an "official" or usual projection, especially if you have data that comes already projected. Sometimes you will have to use WebMercator, if you use raster tiles. Sometimes a projection designed to be good on land at the expense of the ocean, or the other way around.

In any case, I'd say that Equirectangular is a very boring projection, with not many interesting features, and a tendency to vertically "crush" everything that is not on the equator, distorting both the angles and the areas. I would definitely recommend against it, except in very specific cases where you need to align a grid.

You can play with http://www.cartography.oregonstate.edu/demos/AdaptiveCompositeMapProjections/ and use the projection that it recommends for the scale you're optimizing for. (They are all available in D3).

A transverse Mercator can also be very nice if your focus is on a medium-sized region (or a country), for example https://observablehq.com/@fil/corees-koreas

from d3-geo-voronoi.

duynguyen158 avatar duynguyen158 commented on May 23, 2024

Yes! This is exactly what I needed. Thanks!

from d3-geo-voronoi.

martinfrances107 avatar martinfrances107 commented on May 23, 2024

I believe this shows two distinct issues:

  1. when we have 2 columns (and whatever the number of rows), geoVoronoi returns ill-defined polygons.
  2. when you request more than two columns, the polygons are OK, but d3.geoEquirectangular (and, it seems, all the projections that rely on antimeridian clipping) fail to display them properly. (You can see that by switching to d3.geoAzimuthalEqualArea in your notebook.)

Just reading this issue looking for common ground and differences - In comparison to #42.

The problems exposed in 42 are found using the orthographic projection ...
which uses circle clipping not antimeridian ... so my only comment is if 1 and 2 are true
then 42 maybe a way to focus on 1.

from d3-geo-voronoi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.