Find all city objects whose envelope stored in gml:boundedBy is not disjoint with a given bounding box
XML Query
<query xmlns="http://www.3dcitydb.org/importer-exporter/config">
<typeNames>
<typeName xmlns:bldg="http://www.opengis.net/citygml/building/2.0">bldg:Building</typeName>
</typeNames>
<filter>
<bbox>
<envelope>
<lowerCorner>30 10</lowerCorner>
<upperCorner>60 20</upperCorner>
</envelope>
</bbox>
</filter>
</query>
SQL Query for 3DCityDB v4 (PostgreSQL)
select
b.id,
b.objectclass_id,
b.gmlid
from
citydb.cityobject b
where
b.objectclass_id = 26
and b.envelope & & 'SRID=3857;POLYGON((30 10,60 10,60 20,30 20,30 10))'
SQL Query for 3DCityDB v5 (PostgreSQL)
SELECT ftr.id
,ftr.objectclass_id
,ftr.gmlid
FROM feature AS ftr
WHERE ftr.objectclass_id = 26
-- You can use directly low-left and up-right corner points with st_makebox2d function.
-- EPSG code can be defined using: ST_setSRID(st_MakeBox2D(), EPSG_CODE)
AND ftr.envelope && st_MakeBox2D(st_point(0.5, 0.6),st_point(12.7, 7.7));