geo icon indicating copy to clipboard operation
geo copied to clipboard

Add `num_rings` or `rings_count` to `Polygon`

Open frewsxcv opened this issue 3 years ago • 3 comments

frewsxcv avatar Dec 30 '21 17:12 frewsxcv

Is this just 1 + length of interiors vector or am I missing something?

edpft avatar Feb 13 '22 14:02 edpft

Thanks for adding starter bugs for the likes of me :) Is there interest in adding this?

A few clarifications would be useful:

  1. Naming: I'd vote for rings_count to go with existing coords_count (PostGIS uses ST_NRings, geos crate has get_num_interior_rings and nothing that includes the exterior ring).
  2. Should this be added directly to struct impl(s)?
  3. It should probably be added to: Polygon, MultiPolygon, Rect (always 1) and Triangle (always 1).

callpraths avatar Mar 02 '22 06:03 callpraths

I want to answer 2 with: Add geo::algorithm::RingsCount trait, even though it will only be implemented for a few of the core types. There are plenty of examples where algorithms only apply to subset of types (e.g. FrechetDistance only applies to LineString).

callpraths avatar Mar 02 '22 06:03 callpraths

Resolved in https://github.com/georust/geo/pull/1145

frewsxcv avatar Apr 03 '24 02:04 frewsxcv