# Extended Methods on Geometry & Geography Instances

Last updated

Last updated

1. Overview

Cinchy CQL supports a number of extended methods on Open Geospatial Consortium (OGC) methods on geometry and geography instances.Please note that all functions that have been denoted with Geography in parentheses are only applicable to OGC methods on geometry instances.

These function are not currently supported in PostgreSQL deployments of the Cinchy platform.

New function translations are actively being worked on by the development team; please check back at a later time.

You can review the full list of in-progress function translations here.

The extended Methods covered in this section are:

IsValidDetailed (Geometry)

`IsValidDetailed()`

returns a message that can help to identify problems with a spatial object that is not valid.

Only the first error is returned, when the object is not valid. When the object is valid, a value of 24400 is returned.

Syntax

Return Types

CQL: Text

Remarks

The following table contains possible return values:

Geometry Example

This example of an invalid spatial object shows how the `IsValidDetailed()`

methods behaves:

MakeValid (Geometry)

`MakeValid()`

converts an invalid geometry** **instance into a geometry instance with a valid Open Geospatial Consortium (OGC) type.

Syntax

Return Types

CQL: geometry

Remarks

This method may cause a change in the type of the geometry instance, as well as cause the points of a geometry instance to shift slightly.

Geometry Example

This example creates an invalid `LineString`

instance that overlaps itself and uses `MakeValid()`

to make this instance valid:

Reduce (Geometry)

By running the Douglas-Peucker algorithm on the instance with the given tolerance, `Reduce()`

returns an approximation of the given geometry instance produced.

Syntax

Arguments

*tolerance*
The tolerance (type float) to input for the approximation algorithm.

Return Types

CQL: geometry

Remarks

This algorithm operates independently on each geometry contained in the instance, for collection types.

Does not modify `Point`

instances.

For `CircularString`

instances,`Reduce()`

returns a `LineString`

, `CircularString`

, or `CompoundCurve`

instance.

For `CompoundCurve`

instances,`Reduce()`

returns either a `CompoundCurve`

or `LineString`

instance.

On `Polygon`

instances, the approximation algorithm is applied independently to each ring. If the returned `Polygon`

instance is not valid, `Reduce()`

will produce a `FormatException.`

When a circular arc segment is found, the approximation algorithm checks whether the arc can be approximated by its chord within half the given tolerance. Chords meeting this criteria have the circular arc replaced in the calculations by the chord. If a chord doesn't meet this criteria, then the circular arc is kept and the approximation algorithm is applied to the remaining segments.

Geometry Example

This example creates a `LineString`

instance and uses `Reduce()`

to simplify the instance:

ShortestLineTo (Geometry)

`ShortestLineTo()`

returns a `LineString`

instance (which is the distance between the two geometry instances) with two points that represent the shortest distance between the two geometry instances.

Syntax

Arguments

*other_instance*
Specifies the second geometry instance that the calling geometry instance is trying to determine the shortest distance to.

Return Types

CQL: geometry

Remarks

Returns a `LineString`

instance with endpoints lying on the borders of the two non-intersecting geometry instances being compared.

The length of the `LineString`

returned equals the shortest distance between the two geometry instances.

An empty `LineString`

instance is returned when the two geometry instances intersect each other.

Geometry Example

This example returns the `LineString`

instance connecting the two points, by finding the shortest distance between a `CircularString`

instance and a `LineString`

instance:

Return Value

Description

24400

Valid

24401

Not valid, reason unknown.

24402

Not valid because point {0} is an isolated point, which is not valid in this type of object.

24403

Not valid because some pair of polygon edges overlap.

24404

Not valid because polygon ring {0} intersects itself or some other ring.

24405

Not valid because some polygon ring intersects itself or some other ring.

24406

Not valid because curve {0} degenerates to a point.

24407

Not valid because polygon ring {0} collapses to a line at point {1}.

24408

Not valid because polygon ring {0} is not closed.

24409

Not valid because some portion of polygon ring {0} lies in the interior of a polygon.

24410

Not valid because ring {0} is the first ring in a polygon of which it is not the exterior ring.

24411

Not valid because ring {0} lies outside the exterior ring {1} of its polygon.

24412

Not valid because the interior of a polygon with rings {0} and {1} is not connected.

24413

Not valid because of two overlapping edges in curve {0}.

24414

Not valid because an edge of curve {0} overlaps an edge of curve {1}.

24415

Not valid some polygon has an invalid ring structure.

24416

Not valid because in curve {0} the edge that starts at point {1} is either a line or a degenerate arc with antipodal endpoints