-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enable empty coordinantes #99
Conversation
f"{self._wkt_inset}({self._wkt_coordinates})" | ||
if self.coordinates | ||
else " EMPTY" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the 2 abstract method because it was going to create more line of code (repeating the 2 if not self.coordinates
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While there may need to be a couple extra safety checks to keep the type checking happy. Checking the value exists isn't an expensive operation but it cuts down on a lot of duplicated code to use the base functions.
I was actually going to propose a has_z
property specifically to get rid of the _wkt_inset
and get rid of the duplication of the " Z " if ... else " "
everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coordinates
cannot be None
. A Point
must always be a Position
and for anything else []
is acceptable.
I had code for this stashed and will put it up soon. I just added a test and it is now failing so I want to track that down first.
f"{self._wkt_inset}({self._wkt_coordinates})" | ||
if self.coordinates | ||
else " EMPTY" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While there may need to be a couple extra safety checks to keep the type checking happy. Checking the value exists isn't an expensive operation but it cuts down on a lot of duplicated code to use the base functions.
I was actually going to propose a has_z
property specifically to get rid of the _wkt_inset
and get rid of the duplication of the " Z " if ... else " "
everywhere.
@@ -161,22 +154,31 @@ def check_closure(cls, coordinates: List) -> List: | |||
@property | |||
def exterior(self) -> LinearRing: | |||
"""Return the exterior Linear Ring of the polygon.""" | |||
if not self.coordinates: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially I thought this would be a None
, as there is not an exterior at all. But I guess []
could be valid as well.
return self.coordinates[0] | ||
|
||
@property | ||
def interiors(self) -> Iterator[LinearRing]: | ||
"""Interiors (Holes) of the polygon.""" | ||
if not self.coordinates: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is necessary, as the current yield statement already covers this case.
I guess I mis understood this
|
closes #89
TODO: