Skip to content

Add EmptyGeometry class#514

Merged
sgillies merged 1 commit intoshapely:masterfrom
jdmcbr:issue513
Aug 29, 2017
Merged

Add EmptyGeometry class#514
sgillies merged 1 commit intoshapely:masterfrom
jdmcbr:issue513

Conversation

@jdmcbr
Copy link
Copy Markdown
Contributor

@jdmcbr jdmcbr commented Aug 29, 2017

This provides an explicit means of creating an empty geometry object. Motivated by desire for a clear empty geometry type to use in na operations in geopandas. Thanks @sgillies for laying this out in #513, and @jorisvandenbossche for motivation in #510.

I went with EmptyGeometry, rather than Empty, thinking it made the context slightly clearer when used outside of shapely. I created an __init__ mainly for the docstring, while retaining the BaseGeometry docstring for the class; maybe that's not necessary though?

This provides an explicit means of creating an empty geometry object.
Motivated by desire for a clear empty geometry type to use in na
operations in geopandas.
@coveralls
Copy link
Copy Markdown

coveralls commented Aug 29, 2017

Coverage Status

Coverage increased (+0.02%) to 78.563% when pulling bbd3cdd on jdmcbr:issue513 into 1d2568a on Toblerity:master.

@sgillies
Copy link
Copy Markdown
Contributor

@jdmcbr this looks just right to me. Anything else to add?

@jdmcbr
Copy link
Copy Markdown
Contributor Author

jdmcbr commented Aug 29, 2017

@sgillies No, if you're happy with it as is, I don't think there's anything else I'd like to add now.

@sgillies sgillies merged commit c25e34f into shapely:master Aug 29, 2017
@sgillies
Copy link
Copy Markdown
Contributor

@jdmcbr thanks!

@sgillies sgillies added this to the 1.7 milestone Nov 26, 2017
@leblancfg
Copy link
Copy Markdown

Question. Should perhaps geometry classes constructed from None-type values

from shapely.geometry import Point
import numpy as np

p = Point(np.nan, np.nan)

or even

p = Point(-45.2, np.nan)

return an EmptyGeometry instead of POINT(nan, nan)?

@sgillies
Copy link
Copy Markdown
Contributor

sgillies commented Feb 4, 2018

No, I don't think we should mix those cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants