I'm looking for effective methods to store data that represents a 3D sphere made up of points, like a planet with a detailed surface. I'm aware of octrees, but they seem inefficient for handling spherical data. My goal is to easily search the database by starting at the position of a given data point. Are there any proven solutions or creative ideas anyone can suggest?
4 Answers
If you treat your sphere like the Earth, consider using geographic information system (GIS) extensions for databases like MariaDB or PostgreSQL. They utilize quadtree indexing for faster searches, which could be really beneficial for your use case. I even wrote about this approach a while back!
Have you checked out geospatial data handling techniques? You might find inspiration from open source GIS systems that are built to manage spatial data effectively. Just a thought!
For storing just surface points, a 3D array with dimensions based on longitude and latitude could work. This way, you can easily look up points as you map the surface to a 2D plane. But keep in mind this may not be the best for complex geometric data.
You might want to look into something called Healpix, which astronomers use. It’s a method for pixelizing spherical data that allows for quick searching and circle membership testing. It could align well with what you're trying to achieve!

I need to account for subsurface points too, so I wonder if this will be limiting.