Select to view content in your preferred language

Construct ST_Geometry from ST_Points

344
0
06-17-2022 01:07 AM
Status: Open
Bud
by
Honored Contributor

If I understand correctly, it's not possible to construct an ST_Geometry from ST_Point values.

For example, if I want to extract the first segment of a polyline using ST_GEOMETRY functions:

Bud_0-1655451874237.png

...it would be nice if I could do something like this:

select
sde.st_geometry(
sde.st_pointn(shape,1),
sde.st_pointn(shape,2)
,26917) as shape
from
my_lines

Error:
ORA-06553: PLS-306: wrong number or types of arguments in call to 'ST_GEOMETRY'

But instead, I think I need to go to the effort of extracting the X and Y coordinates of each ST_POINT vertex as numbers, then concatenate them together in a WKT string:

select
    'linestring('||
        sde.st_x(sde.st_pointn(shape,1))||' ' ||  
        sde.st_y(sde.st_pointn(shape,1))||', ' ||  
        sde.st_x(sde.st_pointn(shape,2))||' ' ||  
        sde.st_y(sde.st_pointn(shape,2))||')'
    as wkt,
    sde.st_geometry('linestring('||
        sde.st_x(sde.st_pointn(shape,1))||' ' ||  
        sde.st_y(sde.st_pointn(shape,1))||', ' ||  
        sde.st_x(sde.st_pointn(shape,2))||' ' ||  
        sde.st_y(sde.st_pointn(shape,2))||')'
    ,26917) as shape
from
    my_lines

Bud_1-1655452617322.png


That's pretty painful and inefficient. Especially in cases where we're dealing with many vertices (and multi-part geometries).


Idea: Could Esri give us a way to construct ST_Geometries from ST_Points, instead of extracting & concatenating XYs as WKT?

For example, enhance the ST_Geometry() constructor function to allow ST_Points as arguments. Or give us an aggregate function for aggregating features together, similar to what we have with other datatypes like SDO_Geometry.

Thanks.

Tags (2)