I’m querying an SDO_GEOMETRY field to return a given point in a shape, and I would like to get the GPS coordinates for that point. My query is as follows:
select
sdo_lrs.locate_pt(sdo_lrs.convert_to_lrs_geom(shape),0.02).sdo_ordinates
from
TEST_SCHEMA.TEST_TABLE
where
route='ABC'
and
segmentnum='101.1'
This returns an SDO_ORDINATE_ARRAY like so:
MDSYS.SDO_ORDINATE_ARRAY(100000.203621556,999999.57084293,0.02)
How do I convert the first two elements of the SDO_ORDINATE_ARRAY into GPS coordinates? I haven’t been able to find anything in the Oracle Spatial documentation related to a function that would accomplish this.
It turns out you have to transform the coordinate system of the shape before it’s passed to
convert_to_lrs_geom(), usingsdo_cs.transform(). In this case the SRID is 8307 (thanks to jim mcnamara for pointing out that the SRID was the issue), so the SQL to return the correct coordinates is: