You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am attempting to use Cosmos DB to query points within a polygon returned by the Alerts endpoint.
Cosmos DB has a built-in function ST_WITHIN. The documentation states
The GeoJSON specification requires that points within a Polygon be specified in counter-clockwise order. A Polygon specified in clockwise order represents the inverse of the region within it.
According to the Swagger documentation the geometry returned by the Alerts endpoint should follow the IETF RFC 7946 spec. This also describes that the points should be specified counter-clockwise.
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.
However, on my first test of the functionality I am finding that the polygon points appear to be in clockwise order. For example, event https://api.weather.gov/alerts/urn:oid:2.49.0.1.840.0.d5f6be9a186a31226975e648e04790019fba9058.001.1 is not working as I would expect with the ST_WITHIN function. It is interpreting it as a "hole" and returning points outside of the bounding polygon. If I reverse the array it seems to work as expected. Here is the polygon structure:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I am attempting to use Cosmos DB to query points within a polygon returned by the Alerts endpoint.
Cosmos DB has a built-in function ST_WITHIN. The documentation states
According to the Swagger documentation the geometry returned by the Alerts endpoint should follow the IETF RFC 7946 spec. This also describes that the points should be specified counter-clockwise.
However, on my first test of the functionality I am finding that the polygon points appear to be in clockwise order. For example, event
https://api.weather.gov/alerts/urn:oid:2.49.0.1.840.0.d5f6be9a186a31226975e648e04790019fba9058.001.1
is not working as I would expect with the ST_WITHIN function. It is interpreting it as a "hole" and returning points outside of the bounding polygon. If I reverse the array it seems to work as expected. Here is the polygon structure:Am I misinterpreting the data or documentation? Are all polygons represented in the same way from the events endpoint?
Beta Was this translation helpful? Give feedback.
All reactions