WFS空间查询(OGC XML的老写法)

https://www.osgeo.cn/geoserver-user-manual/services/wfs/vendor.html#cql-filters

1、现在都按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:图层服务名称;

outputFormat:输出方式,一般都是application/json

srsname:以哪个坐标系输出结果;

filter:

<Filter xmlns="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml">

     <Intersects>  ///相交

        <PropertyName>geom</PropertyName>  ///  如果是postgis里的数据发的服务,这个字段就是geom,如果是shp数据发的服务,这个字段是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>




空间操作符——拓扑操作符

这些运算符使用标准的OGC Simple Features谓词测试拓扑空间关系:

·        <Intersects>- 测试两个几何是否相交

·        <Disjoint>- 测试两个几何是否不相交

·        <Contains>- 测试几何是否包含另一个几何

·        <Within>- 测试几何是否在另一个之内

·        <Touches>- 测试两个几何体是否接触

·        <Crosses>- 测试两个几何图形是否交叉

·        <Overlaps>- 测试两个几何图形是否重叠

·        <Equals>- 测试两个几何是否在拓扑上相等

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容