Skip to content

Shapely-like transform#37

Merged
mindflayer merged 7 commits intomainfrom
shapely-transform
Dec 14, 2025
Merged

Shapely-like transform#37
mindflayer merged 7 commits intomainfrom
shapely-transform

Conversation

@mindflayer
Copy link
Copy Markdown
Owner

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread SHAPELY_API.md Outdated
Comment thread togo.pyx Outdated
Comment thread tests/test_transform.py
Comment thread tests/test_transform.py
Comment thread tests/test_transform.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 14, 2025

@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.

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 14, 2025

@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.

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 14, 2025

@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.

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 14, 2025

@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.

Copilot AI and others added 5 commits December 14, 2025 21:06
…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>
@mindflayer mindflayer merged commit ea363b9 into main Dec 14, 2025
7 checks passed
@mindflayer mindflayer deleted the shapely-transform branch December 14, 2025 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants