[postgis-devel] length{,2d,3d}

Martin Daly Martin.Daly at cadcorp.com
Wed Aug 25 04:01:24 PDT 2004


Mark,

> Thanks for the pointers, as you suspected I was still looking 
> at just the original spec PDF. The case of a 2D -> 3D cast 
> doesn't appear to be a problem, however it looks like there 
> are some interesting functions to write around the spatial 
> operators, for example collapsing a 3D geom to 2D, 
> calculating the difference, and then interpolating the result 
> back into 3D.... does GEOS already do this? :)

The document addresses this in section 3.1.4, below.

Regards,
Martin

3.1.4 Spatial Relationships

The OpenGIS Simple Features specification defines spatial relationships
in terms of a dimensionally
extended nine-intersection matrix (DE9-IM).

The DE9IM rules for spatial queries are applied to the 2D shadows of all
Z-Geometries. So a 3D point is
inside a Z-Polygon if its (X,Y) location is inside the polygon's 2D
shadow. (For example, this allows
testing whether a 3D GPS location is inside a land-parcel that is
defined as a loop of 3D points.)

Spatial Operators

The OpenGIS Simple Features specification defines various spatial
operators, which can be used to
generate new geometries from existing geometries.

The operators Union, Intersect, SymmetricDifference and Difference are
defined on Z-Geometries by
working on their 2D shadows. This will produce a 2D output. However, the
2D output can be converted
back to 3D by assigning a Z value to each output vertex. This can be
done in a well-defined way, since
each output vertex will either match an input vertex, or it will lie on
a curve of an input geometry, where
the Z is defined using linear interpolation. If an output vertex lies on
both of the input geometries, then the
"this" geometry object is used for the Z value.

The output of operators on mixed 2D and Z-Geometries will be 2D.

The output of the convex-hull operator on a Z-Geometry takes its Z
values from the original Z-Geometry.
Each vertex in the convex-hull output will correspond to a vertex in the
input geometry, so its Z-value is
well defined for simple geometries.

The buffer operator will work on the 2D shadow of Z-Geometries. Each
vertex in the output geometry will
be given a Z value equal to the smallest Z value in the input
Z-Geometry.



More information about the postgis-devel mailing list