-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Overload to_geojson_geometry to support geometries #26451
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
Conversation
| { | ||
| return new GeoJsonWriter().write(geometry); | ||
| GeoJsonWriter geoJsonWriter = new GeoJsonWriter(); | ||
| geoJsonWriter.setEncodeCRS(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this to a separate commit to keep logically independent changes separate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
#26499
| @Description("Returns GeoJSON string based on the input spherical geography") | ||
| @SqlType(VARCHAR) | ||
| public static Slice toGeoJsonGeometry(@SqlType(StandardTypes.SPHERICAL_GEOGRAPHY) Slice input) | ||
| public static Slice toGeoJsonGeometryFromGeography(@SqlType(StandardTypes.SPHERICAL_GEOGRAPHY) Slice input) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename the method to geographyToGeoJson
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's much better. Thank you.
Done
| @ScalarFunction("to_geojson_geometry") | ||
| @Description("Returns GeoJSON string based on the input geometry") | ||
| @SqlType(VARCHAR) | ||
| public static Slice toGeoJsonGeometryFromGeometry(@SqlType(StandardTypes.GEOMETRY) Slice input) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, rename this one to geometryToGeoJson
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| assertGeometryToAndFromJson("LINESTRING (0 0, 1 1, 1 0, 0 1)"); | ||
| } | ||
|
|
||
| private void assertGeometryToAndFromJson(String wkt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename the other method (assertGeoToAndFromJson) to assertGeographyToAndFromJson to avoid confusion with this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
ad9e3f2 to
55f5716
Compare
Description
Allow converting geometries, and not only spherical geographies, to GeoJSON
Additional context and related issues
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text: