Shapely-like transform#37
Conversation
99749f3 to
6651755
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds a Shapely-compatible transform function to the ToGo library, enabling coordinate transformations on all geometry types. The implementation provides feature parity with Shapely's shapely.ops.transform, making it easier for users familiar with Shapely to adopt ToGo.
Key Changes
- Implements recursive coordinate transformation across all geometry types (Point, LineString, Polygon, Multi-geometries, and GeometryCollection)
- Adds comprehensive test coverage for all geometry types
- Includes performance benchmarks comparing ToGo's transform against Shapely's implementation
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| togo.pyx | Adds the main transform function, internal recursive helper _transform_recursive, and coordinate transformation helper _transform_ring_coords; declares new C API function tg_geom_point_at |
| tests/test_transform.py | New test file with 8 test cases covering all geometry types and basic error handling |
| benchmarks/bench_shapely_vs_togo.py | Adds three transform benchmarks (point translation, linestring scaling, polygon rotation) with appropriate imports |
| SHAPELY_API.md | Documents the new transform function with usage examples and updates the API reference table |
| Makefile | Refactors build process by separating build-wheel from build target for better modularity |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@mindflayer I've opened a new pull request, #38, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@mindflayer I've opened a new pull request, #39, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@mindflayer I've opened a new pull request, #40, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@mindflayer I've opened a new pull request, #41, to work on those changes. Once the pull request is ready, I'll request review from you. |
…unction (#38) * Initial plan * Extract duplicated transform validation logic into helper function Co-authored-by: mindflayer <527325+mindflayer@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mindflayer <527325+mindflayer@users.noreply.github.com>
* Initial plan * Add test for simple polygon transform without holes Co-authored-by: mindflayer <527325+mindflayer@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mindflayer <527325+mindflayer@users.noreply.github.com>
* Initial plan * Add comprehensive error case tests for transform function Co-authored-by: mindflayer <527325+mindflayer@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mindflayer <527325+mindflayer@users.noreply.github.com>
* Initial plan * Add tests for transforming empty geometries Co-authored-by: mindflayer <527325+mindflayer@users.noreply.github.com> * Move json import to top of file for consistency Co-authored-by: mindflayer <527325+mindflayer@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mindflayer <527325+mindflayer@users.noreply.github.com> Co-authored-by: Giorgio Salluzzo <giorgio.salluzzo@gmail.com>
No description provided.