Function S2Shape.dimension
Returns the dimension of the geometry represented by this shape.
abstract int dimension() const;
0 - Point geometry. Each point is represented as a degenerate edge.
1 - Polyline geometry. Polyline edges may be degenerate. A shape may represent any number of polylines. Polylines edges may intersect.
2 - Polygon geometry. Edges should be oriented such that the polygon interior is always on the left. In theory the edges may be returned in any order, but typically the edges are organized as a collection of edge chains where each chain represents one polygon loop. Polygons may have degeneracies (e.g., degenerate edges or sibling pairs consisting of an edge and its corresponding reversed edge).
Note that this method allows degenerate geometry of different dimensions to be distinguished, e.g. it allows a point to be distinguished from a polyline or polygon that has been simplified to a single point.