10.12.2012 Views

Oracle Spatial User's Guide and Reference - InfoLab

Oracle Spatial User's Guide and Reference - InfoLab

Oracle Spatial User's Guide and Reference - InfoLab

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

)<br />

AS GmlGeometry FROM DUAL;<br />

SDO_UTIL.TO_GMLGEOMETRY<br />

GMLGEOMETRY<br />

--------------------------------------------------------------------------------<br />

10.1,10<br />

.2, 40.5,10.2, 40.5,41.1, 10.1,41.1, 10.1,10.2 30.3,30.3 30.3,40.1 40.1,40.1 30.3,30.3 5,5 5,6 6,6 6,5 5,5 <<br />

/gml:LinearRing><br />

-- Creating an XMLTYPE from the GML fragment. Also useful for "pretty<br />

-- printing" the GML output.<br />

SET LONG 40000<br />

SELECT XMLTYPE(<br />

SDO_UTIL.TO_GMLGEOMETRY(sdo_geometry(2003, 262152, null,<br />

sdo_elem_info_array(1,1003,1, 11, 2003, 1, 21, 2003, 1),<br />

sdo_ordinate_array(10.10,10.20, 40.50,10.2, 40.5,41.10, 10.1,41.1,<br />

10.10, 10.20, 30.30,30.30, 30.30, 40.10, 40.10, 40.10, 40.10, 30.30,<br />

30.30, 30.30, 5, 5, 5, 6, 6, 6, 6, 5, 5, 5 )))<br />

)<br />

AS GmlGeometry FROM DUAL;<br />

GMLGEOMETRY<br />

--------------------------------------------------------------------------------<br />

10.1,10<br />

.2 40.5,10.2 40.5,41.1 10.1,41.1 10.1,10.2 30.3,30.3 30.3,40.1 40.1,40.1 40.1,30.3 30.3,30.3 5,5 5,6 6,6 6,5 5,5 <br />

The following example uses the TO_GMLGEOMETRY function with the <strong>Oracle</strong><br />

XML DB XMLTYPE data type <strong>and</strong> the XMLELEMENT <strong>and</strong> XMLFOREST functions.<br />

SELECT xmlelement("State", xmlattributes(<br />

'http://www.opengis.net/gml' as "xmlns:gml"),<br />

xmlforest(state as "Name", totpop as "Population",<br />

xmltype(sdo_util.to_gmlgeometry(geom)) as "gml:geometryProperty"))<br />

<strong>Spatial</strong> Utility Subprograms 19-39

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!