You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sedona.apache.org by "prantogg (via GitHub)" <gi...@apache.org> on 2024/02/20 20:56:34 UTC
[PR] [SEDONA-498] Add ST_BestSRID [sedona]
prantogg opened a new pull request, #1246:
URL: https://github.com/apache/sedona/pull/1246
## Did you read the Contributor Guide?
- Yes, I have read [Contributor Rules](https://sedona.apache.org/latest-snapshot/community/rule/) and [Contributor Development Guide](https://sedona.apache.org/latest-snapshot/community/develop/)
## Is this PR related to a JIRA ticket?
- Yes, the URL of the associated JIRA ticket is https://issues.apache.org/jira/browse/SEDONA-XXX. The PR name follows the format `[SEDONA-XXX] my subject`.
## What changes were proposed in this PR?
Adds ST_BestSRID
## How was this patch tested?
## Did this PR include necessary documentation updates?
- Yes, I am adding a new API. I am using the [current SNAPSHOT version number](https://github.com/apache/sedona/blob/99239524f17389fc4ae9548ea88756f8ea538bb9/pom.xml#L29) in since `vX.Y.Z` format.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEDONA-498] Add ST_BestSRID [sedona]
Posted by "prantogg (via GitHub)" <gi...@apache.org>.
prantogg commented on code in PR #1246:
URL: https://github.com/apache/sedona/pull/1246#discussion_r1496943902
##########
docs/api/sql/Function.md:
##########
@@ -474,6 +474,33 @@ Output:
3.141592653589793
```
+## ST_BestSRID
+
+Introduction: Returns the estimated most appropriate Spatial Reference Identifier (SRID) for a given geometry, based on its spatial extent and location. It evaluates the geometry's bounding envelope and selects an SRID that optimally represents the geometry on the Earth's surface. The function prioritizes Universal Transverse Mercator (UTM), Lambert Azimuthal Equal Area (LAEA), or falls back to the Mercator projection.
+
+- For geometries in the Arctic or Antarctic regions, the Lambert Azimuthal Equal Area projection is used.
+- For geometries that fit within a single UTM zone and do not cross the International Date Line, a corresponding UTM SRID is chosen.
+- In cases where none of the above conditions are met, or for geometries that cross the International Date Line, the function defaults to the Mercator projection.
Review Comment:
It does not handle geometries crossing the IDL appropriately. By the below line I mean - geometries crossing the IDL are mishandled and cause the determined SRID to default to Mercator projection SRID.
The mishandling happens with the [`angularWidth`](https://github.com/prantogg/sedona/blob/27f1f6b8e2a833fb6b1885cc2df476f8931fee26/common/src/main/java/org/apache/sedona/common/sphere/Spheroid.java#L134) and `angularHeight` calculation; this causes the [`xwidth`](https://github.com/prantogg/sedona/blob/27f1f6b8e2a833fb6b1885cc2df476f8931fee26/common/src/main/java/org/apache/sedona/common/Functions.java#L206) to be much larger that 6 degrees, which defaults the SRID to mercator.
> In cases where none of the above conditions are met, or for geometries that cross the International Date Line, the function defaults to the Mercator projection.
This line is a bit confusing, let me clarify this in the doc
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEDONA-498] Add ST_BestSRID [sedona]
Posted by "furqaankhan (via GitHub)" <gi...@apache.org>.
furqaankhan commented on code in PR #1246:
URL: https://github.com/apache/sedona/pull/1246#discussion_r1496870083
##########
docs/api/flink/Function.md:
##########
@@ -476,6 +476,33 @@ Output:
3.141592653589793
```
+## ST_BestSRID
+
+Introduction: Returns the estimated most appropriate Spatial Reference Identifier (SRID) for a given geometry, based on its spatial extent and location. It evaluates the geometry's bounding envelope and selects an SRID that optimally represents the geometry on the Earth's surface. The function prioritizes Universal Transverse Mercator (UTM), Lambert Azimuthal Equal Area (LAEA), or falls back to the Mercator projection.
+
+- For geometries in the Arctic or Antarctic regions, the Lambert Azimuthal Equal Area projection is used.
+- For geometries that fit within a single UTM zone and do not cross the International Date Line, a corresponding UTM SRID is chosen.
+- In cases where none of the above conditions are met, or for geometries that cross the International Date Line, the function defaults to the Mercator projection.
+
+!!!Warning
+`ST_BestSRID` is designed to estimate a suitable SRID from a set of approximately 125 EPSG codes and works best for geometries that fit within the UTM zones. It should not be solely relied upon to determine the most accurate SRID, especially for specialized or high-precision spatial requirements.
Review Comment:
I think this wouldn't render correctly as it is missing a tab.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEDONA-498] Add ST_BestSRID [sedona]
Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu merged PR #1246:
URL: https://github.com/apache/sedona/pull/1246
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEDONA-498] Add ST_BestSRID [sedona]
Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu commented on PR #1246:
URL: https://github.com/apache/sedona/pull/1246#issuecomment-1955933778
Snowflake functions of this PR are being tested in a separate PR: https://github.com/wherobots/sedona-snowflake-tester/pull/11
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEDONA-498] Add ST_BestSRID [sedona]
Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu commented on PR #1246:
URL: https://github.com/apache/sedona/pull/1246#issuecomment-1955486944
@prantogg Please add Snowflake doc
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEDONA-498] Add ST_BestSRID [sedona]
Posted by "prantogg (via GitHub)" <gi...@apache.org>.
prantogg commented on code in PR #1246:
URL: https://github.com/apache/sedona/pull/1246#discussion_r1496874915
##########
docs/api/flink/Function.md:
##########
@@ -476,6 +476,33 @@ Output:
3.141592653589793
```
+## ST_BestSRID
+
+Introduction: Returns the estimated most appropriate Spatial Reference Identifier (SRID) for a given geometry, based on its spatial extent and location. It evaluates the geometry's bounding envelope and selects an SRID that optimally represents the geometry on the Earth's surface. The function prioritizes Universal Transverse Mercator (UTM), Lambert Azimuthal Equal Area (LAEA), or falls back to the Mercator projection.
+
+- For geometries in the Arctic or Antarctic regions, the Lambert Azimuthal Equal Area projection is used.
+- For geometries that fit within a single UTM zone and do not cross the International Date Line, a corresponding UTM SRID is chosen.
+- In cases where none of the above conditions are met, or for geometries that cross the International Date Line, the function defaults to the Mercator projection.
+
+!!!Warning
+`ST_BestSRID` is designed to estimate a suitable SRID from a set of approximately 125 EPSG codes and works best for geometries that fit within the UTM zones. It should not be solely relied upon to determine the most accurate SRID, especially for specialized or high-precision spatial requirements.
Review Comment:
Fixed. Good catch. Indentations don't seem to transfer when copy pasting. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEDONA-498] Add ST_BestSRID [sedona]
Posted by "prantogg (via GitHub)" <gi...@apache.org>.
prantogg commented on code in PR #1246:
URL: https://github.com/apache/sedona/pull/1246#discussion_r1496943902
##########
docs/api/sql/Function.md:
##########
@@ -474,6 +474,33 @@ Output:
3.141592653589793
```
+## ST_BestSRID
+
+Introduction: Returns the estimated most appropriate Spatial Reference Identifier (SRID) for a given geometry, based on its spatial extent and location. It evaluates the geometry's bounding envelope and selects an SRID that optimally represents the geometry on the Earth's surface. The function prioritizes Universal Transverse Mercator (UTM), Lambert Azimuthal Equal Area (LAEA), or falls back to the Mercator projection.
+
+- For geometries in the Arctic or Antarctic regions, the Lambert Azimuthal Equal Area projection is used.
+- For geometries that fit within a single UTM zone and do not cross the International Date Line, a corresponding UTM SRID is chosen.
+- In cases where none of the above conditions are met, or for geometries that cross the International Date Line, the function defaults to the Mercator projection.
Review Comment:
It does not handle geometries crossing the IDL appropriately. By the below line I mean - geometries crossing the IDL are mishandled and cause the determined SRID to default to Mercator projection SRID.
The mishandling happens with the `angularWidth` and `angularHeight` calculation; this causes the `xwidth` to be much larger that 6 degrees, which defaults the SRID to mercator.
> In cases where none of the above conditions are met, or for geometries that cross the International Date Line, the function defaults to the Mercator projection.
This line is a bit confusing, let me clarify this in the doc
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEDONA-498] Add ST_BestSRID [sedona]
Posted by "furqaankhan (via GitHub)" <gi...@apache.org>.
furqaankhan commented on code in PR #1246:
URL: https://github.com/apache/sedona/pull/1246#discussion_r1496870213
##########
docs/api/snowflake/vector-data/Function.md:
##########
@@ -320,6 +320,33 @@ SELECT ST_Azimuth(ST_POINT(0.0, 25.0), ST_POINT(0.0, 0.0))
Output: `3.141592653589793`
+## ST_BestSRID
+
+Introduction: Returns the estimated most appropriate Spatial Reference Identifier (SRID) for a given geometry, based on its spatial extent and location. It evaluates the geometry's bounding envelope and selects an SRID that optimally represents the geometry on the Earth's surface. The function prioritizes Universal Transverse Mercator (UTM), Lambert Azimuthal Equal Area (LAEA), or falls back to the Mercator projection.
+
+- For geometries in the Arctic or Antarctic regions, the Lambert Azimuthal Equal Area projection is used.
+- For geometries that fit within a single UTM zone and do not cross the International Date Line, a corresponding UTM SRID is chosen.
+- In cases where none of the above conditions are met, or for geometries that cross the International Date Line, the function defaults to the Mercator projection.
+
+!!!Warning
+`ST_BestSRID` is designed to estimate a suitable SRID from a set of approximately 125 EPSG codes and works best for geometries that fit within the UTM zones. It should not be solely relied upon to determine the most accurate SRID, especially for specialized or high-precision spatial requirements.
Review Comment:
Same thing here, tab missing.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEDONA-498] Add ST_BestSRID [sedona]
Posted by "Kontinuation (via GitHub)" <gi...@apache.org>.
Kontinuation commented on code in PR #1246:
URL: https://github.com/apache/sedona/pull/1246#discussion_r1496908212
##########
docs/api/sql/Function.md:
##########
@@ -474,6 +474,33 @@ Output:
3.141592653589793
```
+## ST_BestSRID
+
+Introduction: Returns the estimated most appropriate Spatial Reference Identifier (SRID) for a given geometry, based on its spatial extent and location. It evaluates the geometry's bounding envelope and selects an SRID that optimally represents the geometry on the Earth's surface. The function prioritizes Universal Transverse Mercator (UTM), Lambert Azimuthal Equal Area (LAEA), or falls back to the Mercator projection.
+
+- For geometries in the Arctic or Antarctic regions, the Lambert Azimuthal Equal Area projection is used.
+- For geometries that fit within a single UTM zone and do not cross the International Date Line, a corresponding UTM SRID is chosen.
+- In cases where none of the above conditions are met, or for geometries that cross the International Date Line, the function defaults to the Mercator projection.
Review Comment:
I've not found how the data line was handled in the implementation. Would you please point out where the date line was handled in `bestSRID` function?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEDONA-498] Add ST_BestSRID [sedona]
Posted by "prantogg (via GitHub)" <gi...@apache.org>.
prantogg commented on code in PR #1246:
URL: https://github.com/apache/sedona/pull/1246#discussion_r1496943902
##########
docs/api/sql/Function.md:
##########
@@ -474,6 +474,33 @@ Output:
3.141592653589793
```
+## ST_BestSRID
+
+Introduction: Returns the estimated most appropriate Spatial Reference Identifier (SRID) for a given geometry, based on its spatial extent and location. It evaluates the geometry's bounding envelope and selects an SRID that optimally represents the geometry on the Earth's surface. The function prioritizes Universal Transverse Mercator (UTM), Lambert Azimuthal Equal Area (LAEA), or falls back to the Mercator projection.
+
+- For geometries in the Arctic or Antarctic regions, the Lambert Azimuthal Equal Area projection is used.
+- For geometries that fit within a single UTM zone and do not cross the International Date Line, a corresponding UTM SRID is chosen.
+- In cases where none of the above conditions are met, or for geometries that cross the International Date Line, the function defaults to the Mercator projection.
Review Comment:
It does not handle geometries crossing the IDL appropriately. By the below line I mean - geometries crossing the IDL are mishandled and cause the determined SRID to default to Mercator projection SRID.
The mishandling happens with the `angularWidth` and `angularHeight` calculation; this causes the `xwidth` to be much larger that 6 degrees, which defaults the SRID to mercator.
> In cases where none of the above conditions are met, or for geometries that cross the International Date Line, the function defaults to the Mercator projection.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEDONA-498] Add ST_BestSRID [sedona]
Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu commented on PR #1246:
URL: https://github.com/apache/sedona/pull/1246#issuecomment-1955935889
Snowflake test failed: https://github.com/wherobots/sedona-snowflake-tester/actions/runs/7984544420/job/21801519880?pr=11
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [SEDONA-498] Add ST_BestSRID [sedona]
Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu commented on code in PR #1246:
URL: https://github.com/apache/sedona/pull/1246#discussion_r1498198362
##########
docs/api/flink/Function.md:
##########
@@ -476,6 +476,34 @@ Output:
3.141592653589793
```
+## ST_BestSRID
+
+Introduction: Returns the estimated most appropriate Spatial Reference Identifier (SRID) for a given geometry, based on its spatial extent and location. It evaluates the geometry's bounding envelope and selects an SRID that optimally represents the geometry on the Earth's surface. The function prioritizes Universal Transverse Mercator (UTM), Lambert Azimuthal Equal Area (LAEA), or falls back to the Mercator projection.
+
+- For geometries in the Arctic or Antarctic regions, the Lambert Azimuthal Equal Area projection is used.
+- For geometries that fit within a single UTM zone and do not cross the International Date Line (IDL), a corresponding UTM SRID is chosen.
+- In cases where none of the above conditions are met, the function defaults to the Mercator projection.
+- For Geometries that cross the IDL, `ST_BestSRID` defaults the SRID to Mercator. Currently, `ST_BestSRID` does not handle geometries crossing the IDL.
+
+!!!Warning
+ `ST_BestSRID` is designed to estimate a suitable SRID from a set of approximately 125 EPSG codes and works best for geometries that fit within the UTM zones. It should not be solely relied upon to determine the most accurate SRID, especially for specialized or high-precision spatial requirements.
+
+Format: `ST_BestSRID(geom: Geometry)`
+
+Since: `v1.6.0`
+
+Spark SQL Example:
Review Comment:
1. Please call it `SQL Example` in all flink, spark, snowflake docs.
2. Please say that this ST_BestSRID functions takes a WGS84 geometry as input and the geometry should follow lon/lat order.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org