Skip to content

Handling of missing geometries #28

@jorisvandenbossche

Description

@jorisvandenbossche

Related to the discussion in geopandas/geopandas#1062

Currently, missing geometries (np.nan, None), are handled similarly to empty geometries:

In [1]: import pygeos

In [4]: a = np.array([None, np.nan, pygeos.Geometry("POLYGON EMPTY"), pygeos.box(0, 0, 1, 1)])

In [5]: a
Out[5]: 
array([None, nan, <pygeos.Empty>,
       <pygeos.Geometry POLYGON ((1 0, 1 1, 0 1, 0 0, 1 0))>],
      dtype=object)

In [6]: pygeos.is_empty(a)
Out[6]: array([ True,  True,  True, False])

But I think, based on your comment in geopandas/geopandas#1062, that it is the idea to separate both concepts?

But also then, there are still some aspects that need to be decided. Quoting @caspervdw from the linked geopandas issue:

I am curious about how to deal with missing values in the various GEOS functions, especially for:

  • predicates (unary and binary)
  • integer-returning functions (like “get_num_points”
  • aggregation functions (should “create_collection” skip or propagate NaN?)

Is it an idea to implement something like NaG (not-a-geometry)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions