I’m trying to write a PostGIS function that takes:
- a geographic coordinate (based on, say, EPSG:3785)
- a density (in points per square meter)
and returns an arbitrary number of points, close to the given coordinate, with a hexagonal distribution at the given density:
But here’s the tricky part: I want it to be deterministic. In other words, I want the collection of points to always be in the same place for a given density, no matter what the given coordinate is. The returned points don't need to contain the given coordinate, but they should be close to it.
For example, if I first generate some points around A, and later generate points around B, I want to make sure that all the points would be "aligned" at the same density if I later filled in all of the points between A and B:
I know this is possible on a 2D plane, but is this even possible on a sphere like our planet? If not, is there a way do something close? The key for my application is determinism - the distribution doesn't need to be a "perfect" hexagon, if that makes things easier.
Can anyone give me some guidance? I’ve read this post about creating hex bins over a given area, but it’s not deterministic.