-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add new features #46
Add new features #46
Conversation
return self.copy().cast_property_to(key, new_type, inplace=True) | ||
|
||
def ensure_unique_ids(self, key='id', verbose: bool = False): |
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.
Looks like a very specific function, which is not needed here in the lib. Need second opinion @adeshkin
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.
Well, I do use it a lot. When working with multiple collections (e.g. rooftops and footprints) it is crucial to have some unique key to match features across them. And if that key is not unique (like when there are several features with same key, or some features does not have key at all), it leads to severe bugs which are difficult to detect. Thats why we need a method like this.
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.
agree with @AlexeyTrekin
return FeatureCollection((f.copy() for f in self.features), crs=self.crs) | ||
|
||
def simplify(self, sigma, inplace=True): |
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.
- There is an apply() function that implements non-inplace modification like this
fc2 = fc.apply(lambda f: f.simplify(tolerance))
so i think it is not worth to add as a separate funciton.
But I love inplace
switch, maybe add it to apply() - with default value False?
- Why
sigma
? In shapely it istolerance
, good to preserve it
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 agree, but fc.simplify(tolerance) looks more readable, than fc = fc.apply(lambda f: f.simplify(tolerance)), isn't it?
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.
OK, it's good to have it.
But let's do it as a convenience function to apply():
- add
inplace
parameter to apply() - rewrite fc.simplify via apply
No description provided.