Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork993
ENH: expose grid_size parameter in shapely functions#3593
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
Uh oh!
There was an error while loading.Please reload this page.
theroggy left a comment
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.
Can you add thegrid_size parameter in the docstrings of the public functions involved in base.py?
nicholas-ys-tan commentedJun 16, 2025
yes sorry, I forgot to do that, added |
martinfleis left a comment
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.
Thanks!
theroggy left a comment
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.
Nice! Some small suggestions...
| GeoSeries.intersection | ||
| """ | ||
| return_binary_geo("difference",self,other,align) | ||
| return_binary_geo("difference",self,other,align,grid_size) |
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.
| return_binary_geo("difference",self,other,align,grid_size) | |
| return_binary_geo("difference",self,other,align,grid_size=grid_size) |
This is best a keyword argument (as in the others below) as it might otherwise give a warning in shapely.
| grid_size : float | None (default None) | ||
| Precision grid size. If 0, will use double precision (will not modify | ||
| geometry if precision grid size was not previously set). If this value is | ||
| more precise than input geometry, the input geometry will not be modified. |
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.
| grid_size :float|None (defaultNone) | |
| Precisiongridsize.If0,willusedoubleprecision (willnotmodify | |
| geometryifprecisiongridsizewasnotpreviouslyset).Ifthisvalueis | |
| moreprecisethaninputgeometry,theinputgeometrywillnotbemodified. | |
| grid_size :float|None (defaultNone) | |
| Thecellsizeoftheprecisiongridtouse.Alltheverticesoftheoutputgeometry | |
| willfallonthegriddefinedbythegridsize.IfNone,thehighestprecision | |
| (smallestgridsize)oftheinputsisused. |
Reusing the docstring ofset_precision isn't really ideal for what is happening here I think.
For clarity: remark applicable for the 4 functions.
My proposal is based on
Looks to expose the
grid_sizeparm as described in#3446 forunion,difference,symmetric_difference,intersection.overlayis a bit more complex as it has its own implementations such asoverlay._overlay_difference(). Will need more thinking on that one.