Skip to content

Shapely like API for exterior#31

Merged
mindflayer merged 7 commits intomainfrom
shapely-exterior
Dec 10, 2025
Merged

Shapely like API for exterior#31
mindflayer merged 7 commits intomainfrom
shapely-exterior

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 updates the ToGo library to provide a more Shapely-compatible API by converting several methods to properties. Specifically, it changes Poly.exterior from a method to a property, and converts several Ring class methods (area, perimeter/length, is_convex, is_clockwise) to properties. The PR also adds a new Poly.length property for perimeter calculation.

  • Converted Poly.exterior() method to exterior property for Shapely compatibility
  • Converted Ring methods (area, perimeter, is_convex, is_clockwise) to properties, with perimeter renamed to length for Shapely compatibility
  • Added new Poly.length property that returns the perimeter of the polygon's exterior ring

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
togo.pyx Converted Poly.exterior, Ring.area, Ring.perimeter (renamed to length), Ring.is_convex, and Ring.is_clockwise from methods to properties; added new Poly.length property; updated __geo_interface__ to use property access; attempted to fix error message string formatting (but has bug)
tests/test_shapely_api.py Updated test calls to use exterior as property instead of method
tests/test_ring.py Updated test calls to use Ring properties (area, length, is_convex, is_clockwise) instead of methods
tests/test_poly.py Updated test calls to use exterior as property and Ring properties instead of methods
tests/test_geometry.py Updated test calls to use exterior as property instead of method
examples/shapely_api_demo.py Updated example to use exterior as property instead of method
benchmarks/bench_shapely_vs_togo.py Updated benchmark to use exterior.length property instead of exterior().perimeter() method
SHAPELY_API.md Updated documentation to show exterior as property instead of method, but comment incorrectly indicates it's a method
README.md Updated some examples to use area and length properties, but is_convex() and is_clockwise() still shown as method calls instead of properties
QUICK_REFERENCE.md Updated documentation to show exterior as property instead of method
setup.py Added compiler flag -Wno-int-in-bool-context to suppress Cython-generated code warnings
Comments suppressed due to low confidence (1)

README.md:182

  • The is_convex and is_clockwise properties should be accessed without parentheses (as properties, not method calls) to be consistent with the changes made to the Ring class in togo.pyx where these were converted from methods to properties with the @property decorator.
print(f"Is convex: {ring.is_convex()}")
print(f"Is clockwise: {ring.is_clockwise()}")

Comment thread SHAPELY_API.md Outdated
Comment thread togo.pyx Outdated
mindflayer and others added 2 commits December 10, 2025 07:19
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Comment thread SHAPELY_API.md Outdated
@mindflayer mindflayer merged commit 53972c3 into main Dec 10, 2025
7 checks passed
@mindflayer mindflayer deleted the shapely-exterior branch December 10, 2025 06:23
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.

2 participants