You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sedona.apache.org by Jon Locke <jl...@indicalab.com> on 2024/04/16 22:38:54 UTC
Creating a geometry column from 4 scalar columns
All the examples I can find start with the assumption that you will create a geometry column with some ST_ function and a single column number. What if I need to create a geometry from multiple columns. For example, the data I have has rectangular geometries in 4 columns: XMin, XMax, YMin, YMax. Is there a way to deal with this in Sedona?
Thanks!
Jon
Re: Creating a geometry column from 4 scalar columns
Posted by Jia Yu <ji...@apache.org>.
Hi Jon,
This can be easily done via ST_PolygonFromEnvelope:
https://sedona.apache.org/latest/api/sql/Constructor/#st_polygonfromenvelope
SELECT ST_PolygonFromEnvelope(tbl.minX, tbl.minY, tbl.maxX, tbl.maxY)
FROM tbl
Thanks,
Jia
On Tue, Apr 16, 2024 at 3:39 PM Jon Locke <jl...@indicalab.com> wrote:
>
> All the examples I can find start with the assumption that you will create
> a geometry column with some ST_ function and a single column number. What
> if I need to create a geometry from multiple columns. For example, the data
> I have has rectangular geometries in 4 columns: XMin, XMax, YMin, YMax. Is
> there a way to deal with this in Sedona?
>
> Thanks!
>
> Jon
>
>