shapely.force_2d

Contents

shapely.force_2d#

force_2d(geometry, **kwargs)#

Force the dimensionality of a geometry to 2D.

Parameters:
geometryGeometry or array_like

Geometry or geometries to force to 2D.

**kwargs

See NumPy ufunc docs for other keyword arguments.

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