shapely.get_coordinate_dimension#

get_coordinate_dimension(geometry, **kwargs)#

Returns the dimensionality of the coordinates in a geometry (2 or 3).

Returns -1 for missing geometries (None values). Note that if the first Z coordinate equals nan, this function will return 2.

Parameters
geometryGeometry or array_like
**kwargs

For other keyword-only arguments, see the NumPy ufunc docs.

Examples

>>> from shapely import Point
>>> get_coordinate_dimension(Point(0, 0))
2
>>> get_coordinate_dimension(Point(0, 0, 1))
3
>>> get_coordinate_dimension(None)
-1
>>> get_coordinate_dimension(Point(0, 0, float("nan")))
2