-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Similarly to shapely.STRTree, it would be nice if we could provide a way in spherely to create a spatial index of a (large) collection of geographies.
A few thoughts:
-
For a collection of single points, s2geometry provides a
S2PointIndex. Actually, I'd be happy to move https://github.com/benbovy/pys2index here, although I think it is useful to also expose it via a simple API like scipy.spatial.cKDTree that is not based on simple features. -
For a collection of arbitrary geometries, would it make sense to reuse
S2ShapeIndex? Which itself can be viewed as a quad-tree...I don't think(EDIT: I misunderstoodMutableS2ShapeIndexwill be very helpful since IIUC it takes ownership of the S2Shape objects added to the indexS2Polyline::Shape,S2Polygon::Shape, etc. that are wrapper classes that do not take ownership of the wrapped S2 objects), but what aboutEncodedS2ShapeIndex? (although still not ideal to duplicate information in the index). Here we want to retrieve (query) s2geography geographies instead of s2geometry shapes, maybe s2geometry's tagging system would make it possible? If we don't allow adding or removing geographies after creating the index, maybe we could use the indices of the array of geographies as tags? @paleolimbot do you think feat: Implement encoding and decoding for geography subclasses paleolimbot/s2geography#40 would help here?