Skip to content

Exposing S2 / s2geography options (for boolean predicates / building operations) #70

@jorisvandenbossche

Description

@jorisvandenbossche

The spatial predicates already use those options, but at the moment we only set them under the hood and don't allow to override them by the user. In this case, s2geography's functions directly allow you to specify the s2geometry S2BooleanOperation::Options

Those S2BooleanOperation options allow you to set the snap function , the polygon/polyline model (open/closed), and a bunch of other things.
And for example we implement covers by calling contains with a "closed" model.

The boolean (overlay, i.e. union/intersection/difference) operations I am adding in #62 also have a somewhat similar (super)set of options. In this case, s2geography defines a GlobalOptions options class (which includes the S2BooleanOperation::Options)
Those options allow you, among other things, to specify whether the output should contain points/polylines/polygons (for example, allowing to limit the intersection of polygons to only return the polygonal intersections).

So for both the predicates and the overlays we need a way to allow the spherely user to customize those options.


In the R s2 package, there is a s2_options() object that gathers all those options (https://r-spatial.github.io/s2/reference/s2_options.html) and that can be passed in those places (https://r-spatial.github.io/s2/reference/s2_contains.html, https://r-spatial.github.io/s2/reference/s2_boundary.html)

(the C++ side of this s2_options() object: https://github.com/r-spatial/s2/blob/main/src/s2-options.h)

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