-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Because GeoJSON expects polygons to have outer ring wound counterclockwise our code should generate polygons like this.
Extent.polygon
is the one place that I found just now that should be switched, but there are probably others.
rapid-sdk/packages/math/src/Extent.ts
Lines 122 to 127 in bb333ea
/** Returns a polygon representing the extent wound clockwise. | |
* @returns Polygon array | |
* @example | |
* new Extent([0, 0], [5, 10]).polygon(); // returns [[0, 0], [0, 10], [5, 10], [5, 0], [0, 0]] | |
*/ | |
polygon(): Vec2[] { |
We can assume that the Extent coordinates are WGS84 aka [longitude,latitude], even though in practice we use Extents for other screen and mercator coordinate systems where Y is flipped.
We can also assume that we are winding the polygons the way most people wind them (looking down at the earth), and not how d3 does it (looking out from the center). 😆
My goal here is to just let me stuff the coordinates into a GeoJSON polygon and have the least surprising thing happen.