Tous les produits
Search
Centre de documentation

ApsaraDB RDS:ST_3DWithin

Dernière mise à jour :Sep 02, 2026

Renvoie true si l'étendue spatiale d'une grille géographique 3D est contenue dans une géométrie 3D ; renvoie false sinon.

Syntaxe

bool ST_3DWithin(geometry geom3d, geomgrid gridcode);
bool ST_3DWithin(geomgrid gridcode, geometry geom3d);
bool ST_3DWithin(meshgeom geom3d, geomgrid gridcode);
bool ST_3DWithin(geomgrid gridcode, meshgeom geom3d);
bool ST_3DWithin(sfmesh geom3d, geomgrid gridcode);
bool ST_3DWithin(geomgrid gridcode, sfmesh geom3d);
bool ST_3DWithin(vomesh geom3d, geomgrid gridcode);
bool ST_3DWithin(geomgrid gridcode, vomesh geom3d);
bool ST_3DWithin(geomgrid gridcode1, geomgrid gridcode2);

Paramètres

Paramètre Type Description
gridcode / gridcode1 / gridcode2 geomgrid Objet de grille géographique.
geom3d geometry, meshgeom, sfmesh ou vomesh Géométrie 3D.

Description

La fonction ST_3DWithin vérifie si l'étendue spatiale d'un objet geomgrid est incluse dans une géométrie 3D.

La géométrie doit utiliser le système de référence spatiale CGC2000. L'identifiant du système de référence spatiale (SRID) doit être 4490.

Exemples

-- A point geometry contains a fine-resolution grid cell (returns true)
SELECT ST_3DWithin('srid=4490;POINT(116.31522216796875 39.910277777777778 1001.8)'::geometry,
ST_GridFromText('GZ00262064446046072072'));
 st_3dwithin
-----------------
 t

-- A coarse-resolution grid cell is not within a closed meshgeom solid (returns false)
SELECT ST_3DWithin(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_3dwithin
-----------------
 f

-- A grid cell is not within an sfmesh geometry built from a unit square (returns false)
SELECT ST_3DWithin(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_3dwithin
-----------------
 f

-- A vomesh pyramid does not contain the coarse grid cell GZ002 (returns false)
SELECT ST_3DWithin(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_GridFromText('GZ002'));
 st_3dwithin
-----------------
 f

-- A finer-resolution grid cell is within a coarser-resolution parent cell (returns true)
SELECT ST_3DWithin(ST_GridFromText('GZ0026206435'),
                       ST_GridFromText('GZ002620643'));
 st_3dwithin
-----------------
 t