shapely.get_type_id

Contents

shapely.get_type_id#

get_type_id(geometry, **kwargs)#

Return the type ID of a geometry.

Possible values are:

  • None (missing) is -1

  • POINT is 0

  • LINESTRING is 1

  • LINEARRING is 2

  • POLYGON is 3

  • MULTIPOINT is 4

  • MULTILINESTRING is 5

  • MULTIPOLYGON is 6

  • GEOMETRYCOLLECTION is 7

Parameters:
geometryGeometry or array_like

Geometry or geometries to get the type ID of.

**kwargs

See NumPy ufunc docs for other keyword arguments.

See also

GeometryType

Examples

>>> from shapely import LineString, Point
>>> get_type_id(LineString([(0, 0), (1, 1), (2, 2), (3, 3)]))
1
>>> get_type_id([Point(1, 2), Point(2, 3)]).tolist()
[0, 0]