Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ST_MAKEELLIPSE Documentation #478

Closed
scoddou opened this issue Feb 6, 2024 · 2 comments
Closed

ST_MAKEELLIPSE Documentation #478

scoddou opened this issue Feb 6, 2024 · 2 comments

Comments

@scoddou
Copy link

scoddou commented Feb 6, 2024

Describe the bug
@vdelacruzb in relation to pull #477

I think the angle argument in ST_MAKEELLIPSE might be positive clockwise, relative y-axis north. I decomposed a "4" point ellipse
(really 5 points) in the example below to check how points were constructed by turf.

Example: when degree is 0, point 1 indexed from 0 is oriented north (aka y-axis relative north, or x-axis relative east). And when degree is 90, point 1 indexed from 0 is oriented east. Not quite sure how to "define" this in the doc's though...

But let me know if I misunderstand the behavior

To Reproduce

WITH

DATA AS (
SELECT '5 DEG' AS TYPE, TO_ARRAY(ST_ASGEOJSON(CARTO.CARTO.ST_MAKEELLIPSE(ST_POINT(-70,40), 2, 10, 5, 'kilometers', 4)):coordinates[0]) AS POINT_ARR
UNION ALL
SELECT '45 DEG' AS TYPE, TO_ARRAY(ST_ASGEOJSON(CARTO.CARTO.ST_MAKEELLIPSE(ST_POINT(-70,40), 2, 10, 45, 'kilometers', 4)):coordinates[0]) AS POINT_ARR
UNION ALL
SELECT '90 DEG' AS TYPE, TO_ARRAY(ST_ASGEOJSON(CARTO.CARTO.ST_MAKEELLIPSE(ST_POINT(-70,40), 2, 10, 90, 'kilometers', 4)):coordinates[0]) AS POINT_ARR
UNION ALL
SELECT '135 DEG' AS TYPE, TO_ARRAY(ST_ASGEOJSON(CARTO.CARTO.ST_MAKEELLIPSE(ST_POINT(-70,40), 2, 10, 135, 'kilometers', 4)):coordinates[0]) AS POINT_ARR
UNION ALL
SELECT '180 DEG' AS TYPE, TO_ARRAY(ST_ASGEOJSON(CARTO.CARTO.ST_MAKEELLIPSE(ST_POINT(-70,40), 2, 10, 180, 'kilometers', 4)):coordinates[0]) AS POINT_ARR
UNION ALL
SELECT '-135 DEG' AS TYPE, TO_ARRAY(ST_ASGEOJSON(CARTO.CARTO.ST_MAKEELLIPSE(ST_POINT(-70,40), 2, 10, -135, 'kilometers', 4)):coordinates[0]) AS POINT_ARR
UNION ALL
SELECT '-90 DEG' AS TYPE, TO_ARRAY(ST_ASGEOJSON(CARTO.CARTO.ST_MAKEELLIPSE(ST_POINT(-70,40), 2, 10, -90, 'kilometers', 4)):coordinates[0]) AS POINT_ARR
UNION ALL
SELECT '-45 DEG' AS TYPE, TO_ARRAY(ST_ASGEOJSON(CARTO.CARTO.ST_MAKEELLIPSE(ST_POINT(-70,40), 2, 10, -45, 'kilometers', 4)):coordinates[0]) AS POINT_ARR
UNION ALL
SELECT '-5 DEG' AS TYPE, TO_ARRAY(ST_ASGEOJSON(CARTO.CARTO.ST_MAKEELLIPSE(ST_POINT(-70,40), 2, 10, -5, 'kilometers', 4)):coordinates[0]) AS POINT_ARR
)

SELECT D.TYPE, (F.INDEX)::VARCHAR AS POINT_INDEX, TO_GEOGRAPHY(OBJECT_CONSTRUCT('type', 'Point', 'coordinates', F.VALUE)) AS GEOG
FROM DATA D,
LATERAL FLATTEN(INPUT=>D.POINT_ARR) F

Screenshots
image

@vdelacruzb
Copy link
Contributor

Hi @scoddou,
Indeed I would say angle is positive clockwise relative to the y-axis north. So I think with the change done in: #477
Users should be able to understand as it also matches turf docs.

@vdelacruzb
Copy link
Contributor

Just merged: #477 so this issue can be closed with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants