Freitag, 25. Juli 2008

Oracle Coordinate System Transformation Functions

-- how to extract srids
SELECT *
FROM mdsys.cs_srs cs
WHERE cs.cs_name LIKE '%UTM%'
AND cs.cs_name LIKE '%32%';

-- how to make a spatial point (WGS84)
SELECT mdsys.sdo_geometry(2001, 8307, mdsys.sdo_point_type(n.x, n.y, NULL), NULL, NULL) AS geometry
FROM nodes n;

-- how to make a converted spatial point (UTM Zone 32, Northern Hemisphere (WGS 84))
SELECT t.geometry.sdo_point.x as x, t.geometry.sdo_point.y as y FROM (SELECT sdo_cs.transform(mdsys.sdo_geometry(2001, 8307, mdsys.sdo_point_type(n.x, n.y, NULL), NULL, NULL), 82344) AS geometry FROM nodes n) t;

82344 is SRID for UTM Zone 32, Northern Hemisphere (WGS 84).

Keine Kommentare: