shapely.force_2d#

force_2d(geometry, **kwargs)#

Forces the dimensionality of a geometry to 2D.

Parameters
geometryGeometry or array_like
**kwargs

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

Examples

>>> from shapely import LineString, Point, Polygon, from_wkt
>>> force_2d(Point(0, 0, 1))
<POINT (0 0)>
>>> force_2d(Point(0, 0))
<POINT (0 0)>
>>> force_2d(LineString([(0, 0, 0), (0, 1, 1), (1, 1, 2)]))
<LINESTRING (0 0, 0 1, 1 1)>
>>> force_2d(from_wkt("POLYGON Z EMPTY"))
<POLYGON EMPTY>
>>> force_2d(None) is None
True