geojson icon indicating copy to clipboard operation
geojson copied to clipboard

First pass at creating correctly-oriented polygons.

Open urschrei opened this issue 6 years ago • 4 comments

See #53

urschrei avatar May 07 '19 14:05 urschrei

@frewsxcv I've had to rename the geo-types feature to geotypes in order to set up multiple crates as a feature (AFAIK you can only use a crate name as a feature name for a single crate). Lmk if there's a better / non-breaking way to accomplish it…

urschrei avatar May 09 '19 11:05 urschrei

From the GeoJSON spec:

   o  A linear ring MUST follow the right-hand rule with respect to the
      area it bounds, i.e., exterior rings are counterclockwise, and
      holes are clockwise.

   Note: the [GJ2008] specification did not discuss linear ring winding
   order.  For backwards compatibility, parsers SHOULD NOT reject
   Polygons that do not follow the right-hand rule.

I'm having a little trouble comprehending this, but it to me it sounds like:

  • When reading GeoJSON, allow clockwise or counterclockwise linear rings
  • When writing GeoJSON, output counterclockwise exterior linear rings, clockwise interior rings

Does that sound right? 🤔


Also, separate thought, but instead of pulling in the entire geo crate, we do have the ability to just add a geo-winding-order crate as a dependency. Just an idea!

frewsxcv avatar Jun 24 '19 03:06 frewsxcv

Does that sound right? 🤔

Yep, that's my understanding! Good idea on the winding-order crate if it gives us a compilation speedup…

urschrei avatar Jun 24 '19 11:06 urschrei

Does that sound right? 🤔

Yep, that's my understanding! Good idea on the winding-order crate if it gives us a compilation speedup…

So considering we'll need to potentially reverse the orientation of linear rings when reading and writing GeoJSON, it seems like we'll need to make a dependency on geo (or geo-winding-order) regardless of whether they have geotypes feature enabled.

frewsxcv avatar Jul 09 '19 04:07 frewsxcv