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.

SDO_UTIL.TO_GMLGEOMETRY<br />

Examples<br />

Any circular arcs or circles must be densified (using the SDO_GEOM.SDO_BUFFER<br />

or SDO_GEOM.SDO_ARC_DENSIFY function) before being passed to the TO_<br />

GMLGEOMETRY function. (See the Examples section for an example that uses<br />

SDO_ARC_DENSIFY with the TO_GMLGEOMETRY function.)<br />

Label points are discarded. That is, if a geometry has a value for the SDO_POINT<br />

field <strong>and</strong> values in SDO_ELEM_INFO <strong>and</strong> SDO_ORDINATES, the SDO_POINT is<br />

not output in the GML fragment.<br />

The SDO_SRID value is output in the form srsName="SDO:". For<br />

example, "SDO:8307" indicates SDO_SRID 8307, <strong>and</strong> "SDO:" indicates a null<br />

SDO_SRID value. No checks are made for the validity or consistency of the SDO_<br />

SRID value. For example, the value is not checked to see if it exists in the<br />

MDSYS.CS_SRS table or if it conflicts with the SRID value for the layer in the<br />

USER_SDO_GEOM_METADATA view.<br />

Coordinates are always output using the tag <strong>and</strong> decimal='.',<br />

cs=',' (that is, with the comma as the coordinate separator), <strong>and</strong> ts=' ' (that is,<br />

with a space as the tuple separator), even if the NLS_NUMERIC_CHARACTERS<br />

setting has ',' (comma) as the decimal character.<br />

The GML output is not formatted; there are no line breaks or indentation of tags. To<br />

see the contents of the returned CLOB in SQL*Plus, use the TO_CHAR() function or<br />

set the SQL*Plus parameter LONG to a suitable value (for example, SET LONG<br />

40000). To get formatted GML output or to use the return value of TO_<br />

GMLGEOMETRY in SQLX or <strong>Oracle</strong> XML DB functions such as XMLELEMENT,<br />

use the XMLTYPE(clobval CLOB) constructor.<br />

The following example returns the GML fragment for the cola_b geometry in the<br />

COLA_MARKETS table. (The example uses the definitions <strong>and</strong> data from<br />

Section 2.1.)<br />

-- Convert cola_b geometry to GML fragment.<br />

SELECT TO_CHAR(SDO_UTIL.TO_GMLGEOMETRY(shape)) AS GmlGeometry<br />

FROM COLA_MARKETS c WHERE c.name = 'cola_b';<br />

GMLGEOMETRY<br />

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

5,1 8,1 8,6 5<br />

,7 5,1 <br />

19-36 <strong>Oracle</strong> <strong>Spatial</strong> User’s <strong>Guide</strong> <strong>and</strong> <strong>Reference</strong>

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

Saved successfully!

Ooh no, something went wrong!