Skip to content

Segfault when creating MultiPoint from sequence including empty point  #134

@jorisvandenbossche

Description

@jorisvandenbossche

Triggered by a similar Shapely issue (shapely/shapely#898, shapely/shapely#836), I wondered how this would work in pygeos.

It's not that easy to create an empty point, so using a workaround with intersection:

In [1]: import pygeos 

In [8]: p = pygeos.points(1,1) 

In [9]: box = pygeos.box(2,2,4,4)  

In [10]: p_empty = pygeos.intersection(p, box)     

In [11]: p_empty  
Out[11]: <pygeos.Geometry POINT EMPTY>

Then trying to create a MultiPoint from a list that includes this empty point segfaults:

In [12]: pygeos.multipoints([p, p_empty])  
Out[12]: Segmentation fault (core dumped)

Creating one from just an empty point works, resulting in an empty MultiPoint:

In [5]: pygeos.multipoints([p_empty]) 
Out[5]: <pygeos.Geometry MULTIPOINT EMPTY>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions