Skip to content

Querying geographies (spatial index) #72

@benbovy

Description

@benbovy

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 MutableS2ShapeIndex will be very helpful since IIUC it takes ownership of the S2Shape objects added to the index (EDIT: I misunderstood S2Polyline::Shape, S2Polygon::Shape, etc. that are wrapper classes that do not take ownership of the wrapped S2 objects), but what about EncodedS2ShapeIndex? (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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions