developmentseed / developmentseed/lonboard

Polygon winding order

Open
#67 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
964
Forks
54
Avg merge
5m
Merged PRs (30d)
1

Description

The deck.gl [`SolidPolygonLayer`](https://deck.gl/docs/api-reference/layers/solid-polygon-layer) has a [render option `_windingOrder`](https://deck.gl/docs/api-reference/layers/solid-polygon-layer#_windingorder) which says

> This prop is only effective with `_normalize: false`. It specifies the winding order of rings in the polygon data, one of:
>
> - `'CW'`: outer-ring is clockwise, and holes are counter-clockwise
> - `'CCW'`: outer-ring is counter-clockwise, and holes are clockwise
>
> The proper value depends on the source of your data. Most geometry formats [enforce a specific winding order](https://gis.stackexchange.com/a/147971). Incorrectly set winding order will cause an extruded polygon's surfaces to be flipped, affecting culling and the lighting effect.

Thus, this is probably not the highest priority, given that it only happens with extruded polygons, but should be fixed eventually.

In GEOS, polygon winding order is unspecified, so we'd need to check/force it manually. There's no vectorized shapely function to do this, ref https://github.com/shapely/shapely/issues/1366. So the options are either:

- non-vectorized shapely implementation of orient. This would be unacceptably slow.
- geoarrow-based orient implementation in python. This would be ideal but not likely to be imminently implemented.
- JS-based orientation implementation. This either brings in a wasm implementation (not ideal here) or implements a custom JS function on geoarrow arrays (preferred, but the tooling for geoarrow in pure JS isn't there yet)

So the end goal here is:

- Implement a fast winding order algorithm in rust on geoarrow memory to do in python.
- Implement an orientation checking function in pure JS on geoarrow memory (maybe in geoarrow/deck.gl-layers for now)
- Set the [geoarrow winding order flag](https://github.com/geoarrow/geoarrow/issues/49) when winding order is checked/validated in python so it doesn't get done again in js.

Ref https://github.com/geoarrow/deck.gl-layers/issues/36

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.