1 Geometry accessors

1.1 geo.getType

Returns the type of geometry as a string, for example 'LINESTRING', 'POLYGON', 'MULTIPOINT, etc.

<geo.getType>
    <geom_column /> *
</geo.getType>
Example
Copy
<select>
    <columns>
        <geo.getType>a.the_geom</geo.getType>,
        <geo.getType>
            <geo.polygon>
               <coords>0 0,0 1,1 1,1 0,0 0</coords>
               <srid>4326</srid>
            </geo.polygon>
        </geo.getType>
    </columns>
    <from table='roads'  alias='a' />
</select>

1.2 geo.getX

Returns the coordinate X of a point. This function can only be used in Informix and Postgres. In addition, the geometric objects to which it applies are required to be of type POINT. Thus, it cannot be applied directly to points stored in columns of geometric type.

<geo.getX>
    <geom_column /> *
</geo.getX>
Example
Copy
<select>
    <columns>
        <geo.getX>a.the_geom</geo.getX>
    </columns>
    <from table='points' alias='a' />
</select>

1.3 geo.getY

Returns the Y coordinate of a point. This function can only be used in Informix and Postgres. In addition, the geometric objects to which it applies are required to be of type POINT. Thus, it cannot be applied directly to points stored in columns of geometric type.

<geo.getY>
    <geom_column /> *
</geo.getY>
Example
Copy
<select>
    <columns>
        <geo.getY>a.the_geom</geo.getY>
    </columns>
    <from table='points' alias='a' />
</select>

1.4 geo.getZ

Returns the coordinate Z of a point. This function can only be used in Informix and Postgres. In addition, the geometric objects to which it applies are required to be of type POINT. Thus, it cannot be applied directly to points stored in columns of geometric type.

<geo.getZ>
    <geom_column /> *
</geo.getZ>
Example
Copy
<select>
    <columns>
        <geo.getZ>a.the_geom</geo.getZ>
    </columns>
    <from table='points' alias='a' />
</select>

1.5 geo.getEnvelope

Returns the geometry of the smallest box that fits the geometry passed as a parameter. Usually it will be a rectangle, but for a point you get the same point, and for a horizontal or vertical line you get the line defined by its extreme points.

<geo.getEnvelope>
    <geom_column /> *
</geo.getEnvelope>
Example
Copy
<select>
    <columns>
        <geo.getEnvelope>a.the_geom</geo.getEnvelope>,
         <geo.getEnvelope>
            <geo.polygon>
               <coords>0 0,0 1,1 1,1 0,0 0</coords>
               <srid>4326</srid>
            </geo.polygon>
         </geo.getEnvelope>
    </columns>
    <from table='roads'  alias='a'  />
</select>

1.6 geo.isValid

Returns TRUE if the geometry is well formed.

<geo.isValid>
    <geom_column /> *
</geo.isValid>
Example
Copy
<select>
    <columns>
        <geo.isWktValid>a.the_geom</geo.isWktValid>,

        -- TRUE
        <geo.isValid ora_iswkt='y'>
            <geo.asWkt>
                <geo.polygon>
                   <coords>0 0,0 1,1 1,1 0,0 0</coords>
                   <srid>4326</srid>
                </geo.polygon>
            </geo.asWkt>
        </geo.isWktValid>,

        -- FALSE
        <geo.isValid>
            <geo.polygon>
               <coords>0 0,0 1,1 1,1 0,23 0</coords>
               <srid>4326</srid>
            </geo.polygon>
        </geo.isValid>,
    </columns>
    <from table='dual' alias='a' />
</select>

1.7 geo.getDim

Returns the number of dimensions of the geometric object.

<geo.getDim>
    <geom_column /> *
</geo.getDim>
Example
Copy
<select>
    <columns>
        -- 1
        <geo.getDim>a.the_geom</geo.getDim>,

        -- 2
        <geo.getDim>
            <geo.polygon>
               <coords>0 0,0 1,1 1,1 0,0 0</coords>
               <srid>4326</srid>
            </geo.polygon>
        </geo.getDim>,
    </columns>
    <from table='dual' alias='a' />
</select>

1.8 geo.getSRID

Returns the reference system identifier (Spatial Reference Identifier, SRID)

<geo.getSRID>
    <geom_column /> *
</geo.getSRID>
Example
Copy
<select>
    <columns>

        <geo.getSRID>a.the_geom</geo.getSRID>,


        <geo.getSRID>
            <geo.polygon>
               <coords>0 0,0 1,1 1,1 0,0 0</coords>
               <srid>4326</srid>
            </geo.polygon>
        </geo.getDim>,
    </columns>
    <from table='dual' alias='a' />
</select>

1.9 geo.getNumVertices

Returns the number of points in a geometry.

<geo.getNumVertices>
    <geom_column /> *
</geo.getNumVertices>
Example
Copy
<select>
    <columns>
        <geo.getNumVertices>a.the_geom</geo.getNumVertices>,

    </columns>
    <from table='dual' alias='a' />
</select>