Skip to content

Shapely 2.0: deprecate BaseGeometry() and EmptyGeometry() ? #1022

@jorisvandenbossche

Description

@jorisvandenbossche

In current Shapely, the base class BasecGeometry constructor can be called, creating an empty GeometryCollection:

>>> from shapely.geometry.base import BaseGeometry
>>> geom = BaseGeometry()
>>> print(geom)
GEOMETRYCOLLECTION EMPTY

However, if you want an empty geometry collection, you can also explicitly create one with eg GeometryCollection(). So I think it is not needed to have a working constructor for the BaseGeometry.

I know that at some point in geopandas we did use this to create an empty geometry, so it might be worth actually deprecating this in Shapely 1.8.


In addition, a more explicit EmptyGeometry was added (actually to address the issue that geopandas was using BaseGeometry() to get an empty geometry -> #514).
But since there is no "generic" empty type in GEOS, but only empty geometries of one of the specific geometry types (EmptyGeometry() also creates an empty GeometryCollection), in hindsight, this EmptyGeometry class doesn't seem that useful, and even somewhat misleading.

So I would propose to also deprecate this class (in favor of using the explicit constructors, like Point(), Polygon(), GeometryCollection(), ...)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions