-
Notifications
You must be signed in to change notification settings - Fork 560
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
Rename shapely.apply to shapely.transform #1393
Rename shapely.apply to shapely.transform #1393
Conversation
Pull Request Test Coverage Report for Build 2524317425
💛 - Coveralls |
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.
Yes to "transform" for this type of operation.
A new GEOS 3.11 feature is GEOSGeom_transformXY
(and GEOSTransformXYCallback
). This functionality has not yet made it into Shapely yet, although I can see that it would be useful optimization for "(N, 2)->(N, 2)" cases within shapely.coordinates.transform()
.
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.
+1 on the name change
|
||
|
||
def apply(geometry, transformation, include_z=False): | ||
def transform(geometry, transformation, include_z=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.
The docstring should also be adjusted. And maybe also change the names all the way down to C?
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.
Updated the docstring
The method currently only lives on the python side (the actual C funcs being called here are |
xref #1276 about naming inconsistencies
Shapely uses "transform" for what is called
apply
for the vectorized functions (merged from pygeos). This PR renamesapply()
totransform()
.I personally think both names are fine, so this change keeps it a bit more consistent in shapely.
(I might actually even like "transform" a bit more, as it signals more that the geometry coordinates are only transformed, keeping the exact structure. While applying a function in general could return something else as geometries. For example, in pandas, there is a more generic "apply" (that can basically return anything) vs more specific "transform" (which is guaranteed to keep the same shaped output))