WFS1.0.0空間查詢(OGC XML的老寫法)
時間:2023-05-10 04:27:02 | 來源:網(wǎng)站運(yùn)營
時間:2023-05-10 04:27:02 來源:網(wǎng)站運(yùn)營
WFS1.0.0空間查詢(OGC XML的老寫法):https://www.osgeo.cn/geoserver-user-manual/services/wfs/vendor.html#cql-filters
1、現(xiàn)在都按ECQL 的寫法,會單獨寫一篇,不在此贅述。
2、按OGC XML過濾器的寫法:(比較難寫也不易讀)
點的空間查詢:
http://localhost:8088/geoserver/geomonitor/ows?service=WFS&version=1.0.0&request=GetFeature&typename=geomonitor:community_population&outputFormat=application/json&srsname=EPSG:3857&filter=<Filter xmlns="
http://www.opengis.net/ogc" xmlns:gml="
http://www.opengis.net/gml"><Intersects><PropertyName>geom</PropertyName><gml:Point><gml:coordinates>'+coor[0]+','+coor[1]+'</gml:coordinates></gml:Point></Intersects></Filter>
typename:圖層服務(wù)名稱;
outputFormat:輸出方式,一般都是application/json
srsname:以哪個坐標(biāo)系輸出結(jié)果;
filter:
<Filter xmlns="
http://www.opengis.net/ogc" xmlns:gml="
http://www.opengis.net/gml">
<Intersects> ///相交
<PropertyName>geom</PropertyName> /// 如果是postgis里的數(shù)據(jù)發(fā)的服務(wù),這個字段就是geom,如果是shp數(shù)據(jù)發(fā)的服務(wù),這個字段是the_geom,不知道原因,不知道是否可以修改字段名。
<gml:Point><gml:coordinates>'+coor[0]+','+coor[1]+'</gml:coordinates></gml:Point>
</Intersects>
</Filter>
線:
<Filter xmlns="
http://www.opengis.net/ogc" xmlns:gml="
http://www.opengis.net/gml">
<Within>
<PropertyName>GEOM</PropertyName>
<gml:LineString>
<gml:coordinates>113.763,34.435 113.763,34.5 113.844,34.5 113.844,34.435</gml:coordinates>
</gml:LineString>
</Within>
</Filter>
面:
<Filter xmlns="
http://www.opengis.net/ogc" xmlns:gml="
http://www.opengis.net/gml">
<Intersects><PropertyName>GEOM</PropertyName><gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>113.763,34.435 113.763,34.5 113.763,34.435</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon></Intersects></Filter>
空間操作符——拓?fù)洳僮鞣?br>這些運(yùn)算符使用標(biāo)準(zhǔn)的OGC Simple Features謂詞測試拓?fù)淇臻g關(guān)系:
· <Intersects>- 測試兩個幾何是否相交
· <Disjoint>- 測試兩個幾何是否不相交
· <Contains>- 測試幾何是否包含另一個幾何
· <Within>- 測試幾何是否在另一個之內(nèi)
· <Touches>- 測試兩個幾何體是否接觸
· <Crosses>- 測試兩個幾何圖形是否交叉
· <Overlaps>- 測試兩個幾何圖形是否重疊
· <Equals>- 測試兩個幾何是否在拓?fù)渖舷嗟?br>
作者:什么時候能貓狗雙全
鏈接:
https://www.jianshu.com/p/d2c0904bdf8c來源:簡書