-
Notifications
You must be signed in to change notification settings - Fork 56
feat(rust/sedona-functions): implement ST_XxxFromText typed geometry constructors (issue #205) #993
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
Merged
paleolimbot
merged 3 commits into
apache:main
from
ajaypadwal73:feat/st-geomfromtext-variants-clean
Jun 24, 2026
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
493c6ee
feat: implement ST_XxxFromText typed geometry constructors (issue #205)
ajaypadwal73 183287e
refactor: use GeometryTypeId for typed constructors, add Python tests…
ajaypadwal73 fc5c0b5
fix(tests): correct PostGIS behavioral differences in typed construct…
ajaypadwal73 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| --- | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| title: ST_GeomCollFromText | ||
| description: Constructs a GeometryCollection from Well-Known Text (WKT), erroring if the input is not a GeometryCollection. | ||
| kernels: | ||
| - returns: geometry | ||
| args: | ||
| - name: wkt | ||
| type: string | ||
| - returns: geometry | ||
| args: | ||
| - name: wkt | ||
| type: string | ||
| - name: srid | ||
| type: crs | ||
| --- | ||
|
|
||
| ## Description | ||
|
|
||
| Parses a WKT string and returns a geometry. Raises an error if the WKT does not represent a GeometryCollection. | ||
|
|
||
| ## Examples | ||
|
|
||
| ```sql | ||
| SELECT ST_GeomCollFromText('GEOMETRYCOLLECTION (POINT (0 0), LINESTRING (0 0, 1 1))'); | ||
| ``` | ||
|
|
||
| With an SRID: | ||
|
|
||
| ```sql | ||
| SELECT ST_GeomCollFromText('GEOMETRYCOLLECTION (POINT (0 0), LINESTRING (0 0, 1 1))', 4326); | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| --- | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| title: ST_LineFromText | ||
| description: Constructs a LineString from Well-Known Text (WKT), erroring if the input is not a LineString. | ||
| kernels: | ||
| - returns: geometry | ||
| args: | ||
| - name: wkt | ||
| type: string | ||
| - returns: geometry | ||
| args: | ||
| - name: wkt | ||
| type: string | ||
| - name: srid | ||
| type: crs | ||
| --- | ||
|
|
||
| ## Description | ||
|
|
||
| Parses a WKT string and returns a geometry. Raises an error if the WKT does not represent a LineString. | ||
|
|
||
| This function also has the alias `ST_LineStringFromText`. | ||
|
|
||
| ## Examples | ||
|
|
||
| ```sql | ||
| SELECT ST_LineFromText('LINESTRING (0 0, 1 1, 2 2)'); | ||
| ``` | ||
|
|
||
| With an SRID: | ||
|
|
||
| ```sql | ||
| SELECT ST_LineFromText('LINESTRING (0 0, 1 1, 2 2)', 4326); | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| --- | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| title: ST_MLineFromText | ||
| description: Constructs a MultiLineString from Well-Known Text (WKT), erroring if the input is not a MultiLineString. | ||
| kernels: | ||
| - returns: geometry | ||
| args: | ||
| - name: wkt | ||
| type: string | ||
| - returns: geometry | ||
| args: | ||
| - name: wkt | ||
| type: string | ||
| - name: srid | ||
| type: crs | ||
| --- | ||
|
|
||
| ## Description | ||
|
|
||
| Parses a WKT string and returns a geometry. Raises an error if the WKT does not represent a MultiLineString. | ||
|
|
||
| ## Examples | ||
|
|
||
| ```sql | ||
| SELECT ST_MLineFromText('MULTILINESTRING ((0 0, 1 1), (2 2, 3 3))'); | ||
| ``` | ||
|
|
||
| With an SRID: | ||
|
|
||
| ```sql | ||
| SELECT ST_MLineFromText('MULTILINESTRING ((0 0, 1 1), (2 2, 3 3))', 4326); | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| --- | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| title: ST_MPointFromText | ||
| description: Constructs a MultiPoint from Well-Known Text (WKT), erroring if the input is not a MultiPoint. | ||
| kernels: | ||
| - returns: geometry | ||
| args: | ||
| - name: wkt | ||
| type: string | ||
| - returns: geometry | ||
| args: | ||
| - name: wkt | ||
| type: string | ||
| - name: srid | ||
| type: crs | ||
| --- | ||
|
|
||
| ## Description | ||
|
|
||
| Parses a WKT string and returns a geometry. Raises an error if the WKT does not represent a MultiPoint. | ||
|
|
||
| ## Examples | ||
|
|
||
| ```sql | ||
| SELECT ST_MPointFromText('MULTIPOINT ((0 0), (1 1), (2 2))'); | ||
| ``` | ||
|
|
||
| With an SRID: | ||
|
|
||
| ```sql | ||
| SELECT ST_MPointFromText('MULTIPOINT ((0 0), (1 1), (2 2))', 4326); | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| --- | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| title: ST_MPolyFromText | ||
| description: Constructs a MultiPolygon from Well-Known Text (WKT), erroring if the input is not a MultiPolygon. | ||
| kernels: | ||
| - returns: geometry | ||
| args: | ||
| - name: wkt | ||
| type: string | ||
| - returns: geometry | ||
| args: | ||
| - name: wkt | ||
| type: string | ||
| - name: srid | ||
| type: crs | ||
| --- | ||
|
|
||
| ## Description | ||
|
|
||
| Parses a WKT string and returns a geometry. Raises an error if the WKT does not represent a MultiPolygon. | ||
|
|
||
| ## Examples | ||
|
|
||
| ```sql | ||
| SELECT ST_MPolyFromText('MULTIPOLYGON (((0 0, 1 0, 1 1, 0 0)), ((2 2, 3 2, 3 3, 2 2)))'); | ||
| ``` | ||
|
|
||
| With an SRID: | ||
|
|
||
| ```sql | ||
| SELECT ST_MPolyFromText('MULTIPOLYGON (((0 0, 1 0, 1 1, 0 0)), ((2 2, 3 2, 3 3, 2 2)))', 4326); | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| --- | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| title: ST_PointFromText | ||
| description: Constructs a Point from Well-Known Text (WKT), erroring if the input is not a Point. | ||
| kernels: | ||
| - returns: geometry | ||
| args: | ||
| - name: wkt | ||
| type: string | ||
| - returns: geometry | ||
| args: | ||
| - name: wkt | ||
| type: string | ||
| - name: srid | ||
| type: crs | ||
| --- | ||
|
|
||
| ## Description | ||
|
|
||
| Parses a WKT string and returns a geometry. Raises an error if the WKT does not represent a Point. | ||
|
|
||
| ## Examples | ||
|
|
||
| ```sql | ||
| SELECT ST_PointFromText('POINT (30 10)'); | ||
| ``` | ||
|
|
||
| With an SRID: | ||
|
|
||
| ```sql | ||
| SELECT ST_PointFromText('POINT (30 10)', 4326); | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,48 @@ | ||||||
| --- | ||||||
| # Licensed to the Apache Software Foundation (ASF) under one | ||||||
| # or more contributor license agreements. See the NOTICE file | ||||||
| # distributed with this work for additional information | ||||||
| # regarding copyright ownership. The ASF licenses this file | ||||||
| # to you under the Apache License, Version 2.0 (the | ||||||
| # "License"); you may not use this file except in compliance | ||||||
| # with the License. You may obtain a copy of the License at | ||||||
| # | ||||||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||||||
| # | ||||||
| # Unless required by applicable law or agreed to in writing, | ||||||
| # software distributed under the License is distributed on an | ||||||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||||||
| # KIND, either express or implied. See the License for the | ||||||
| # specific language governing permissions and limitations | ||||||
| # under the License. | ||||||
|
|
||||||
| title: ST_PolygonFromText | ||||||
| description: Constructs a Polygon from Well-Known Text (WKT), erroring if the input is not a Polygon. | ||||||
| kernels: | ||||||
| - returns: geometry | ||||||
| args: | ||||||
| - name: wkt | ||||||
| type: string | ||||||
| - returns: geometry | ||||||
| args: | ||||||
| - name: wkt | ||||||
| type: string | ||||||
| - name: srid | ||||||
| type: crs | ||||||
| --- | ||||||
|
|
||||||
| ## Description | ||||||
|
|
||||||
| Parses a WKT string and returns a geometry. Raises an error if the WKT does not represent a Polygon. | ||||||
|
|
||||||
| ## Examples | ||||||
|
|
||||||
| ```sql | ||||||
| SELECT ST_PolygonFromText('POLYGON ((0 0, 4 0, 4 4, 0 4, 0 0))'); | ||||||
| ``` | ||||||
|
|
||||||
| With an SRID: | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
(For the others as well) |
||||||
|
|
||||||
| ```sql | ||||||
| SELECT ST_PolygonFromText('POLYGON ((0 0, 4 0, 4 4, 0 4, 0 0))', 4326); | ||||||
| ``` | ||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.