Tests whether the 3D spatial range of a geographic grid intersects with a geometry. Supported geometry types: geometry, meshgeom, sfmesh, vomesh, and geomgrid.
Syntax
bool ST_3DIntersects(geometry geom3d, geomgrid gridcode);
bool ST_3DIntersects(geomgrid gridcode, geometry geom3d);
bool ST_3DIntersects(meshgeom geom3d, geomgrid gridcode);
bool ST_3DIntersects(geomgrid gridcode, meshgeom geom3d);
bool ST_3DIntersects(sfmesh geom3d, geomgrid gridcode);
bool ST_3DIntersects(geomgrid gridcode, sfmesh geom3d);
bool ST_3DIntersects(vomesh geom3d, geomgrid gridcode);
bool ST_3DIntersects(geomgrid gridcode, vomesh geom3d);
bool ST_3DIntersects(geomgrid gridcode1, geomgrid gridcode2);Parameters
| Parameter | Description |
|---|---|
| gridcode / gridcode1 / gridcode2 | The geographic grid object. |
| geom3d | The 3D geometry. |
Description
Returns true if the 3D spatial range of the grid intersects with the geometry, false otherwise.
The geometry must use the CGC2000 spatial reference system. The spatial reference system identifier (SRID) must be 4490.Examples
geometry and geomgrid
SELECT ST_3DIntersects(ST_GridFromText('GZ00262064446046072072'),
'srid=4490;POINT(116.31522216796875 39.910277777777778 1001.8)'::geometry);
st_3dintersects
-----------------
fThe point falls outside the 3D spatial range of grid GZ00262064446046072072, so the function returns f.
meshgeom and geomgrid
SELECT ST_3DIntersects(ST_GridFromText('GZ0026'),
st_meshgeomfromtext('srid=4490;SOLID=TRUE;MESHGEOM(PATCH(INDEXSURFACE Z (VERTEX(115.966 38.9757000000001 3000,
116 38.9757000000001 3000,116 38.9999999999999 3000,115.966 38.9999999999999 3000,116 38.9999999999999 0,
116 38.9757000000001 0,115.966 38.9757000000001 0,115.966 38.9999999999999 0),
INDEX((0,1,2),(2,3,0),(4,5,6),(6,7,4),(3,7,6),(6,0,3),(0,6,5),(5,1,0),(1,5,4),(4,2,1),(2,4,7),(7,3,2)))))'));
st_3dintersects
-----------------
tsfmesh and geomgrid
The sfmesh type uses a JSON-based format. The matrix field in the nodes array applies a transformation to the mesh geometry.
SELECT ST_3DIntersects(ST_GridFromText('GZ00262064'), st_meshfromtext(
'{"version" : 1, "srid" : 4490, "root" : 0,
"meshgeoms" : ["MESHGEOM(PATCH(POLYGON Z ((0 0 0,1 0 0,1 1 0,0 1 0,0 0 0))))"],
"primitives" : [{"meshgeom" : 0}], "nodes" : [{"primitive" : 0,"matrix" : [0.012,0,0,116,0,0.009,0,39,0,0,1000,0,0,0,0,1]}]}'));
st_3dintersects
-----------------
tvomesh and geomgrid
SELECT ST_3DIntersects(ST_GridFromText('GZ00262064'), ST_VOMeshFromText(
'SRID=4490;LOD=2;VOMESH(VERTEX(COORDS(116.012 39 0,116 39.009 0,115.988 39 0,116 38.991 0,116 39 1000)),
FACE(INDEX((0,1,2,3),(1,0,4),(2,1,4),(3,2,4),(0,3,4))),CELL(INDEX((0,1,2,3,4)),DIRECTION((0,1,1,1,0))))'));
st_3dintersects
-----------------
tgeomgrid and geomgrid
SELECT ST_3DIntersects(ST_GridFromText('GZ00262064'),
ST_GridFromText('GZ00262063'));
st_3dintersects
-----------------
t