Interface S2Region

An S2Region represents a two-dimensional region over the unit sphere. It is an abstract interface with various concrete subtypes.

interface S2Region ;

The main purpose of this interface is to allow complex regions to be approximated as simpler regions. So rather than having a wide variety of virtual methods that are implemented by all subtypes, the interface is restricted to methods that are useful for computing approximations.

Methods

NameDescription
clone () Returns a deep copy of the region.
contains (p) Returns true if and only if the given point is contained by the region. The point 'p' is generally required to be unit length, although some subtypes may relax this restriction.
contains (cell) Returns true if the region completely contains the given cell, otherwise returns false.
getCapBound () Returns a bounding spherical cap that contains the region. The bound may not be tight.
getCellUnionBound (cellIds) Returns a small collection of S2CellIds whose union covers the region. The cells are not sorted, may have redundancies (such as cells that contain other cells), and may cover much more area than necessary.
getRectBound () Returns a bounding latitude-longitude rectangle that contains the region. The bound may not be tight.
mayIntersect (cell) If this method returns false, the region does not intersect the given cell. Otherwise, either region intersects the cell, or the intersection relationship could not be determined.