
WFS,即Web要素服务,支持对地理要素的插入,更新,删除,检索和发现服务。不同于WMS(Web地图服务)的是,该服务专注于要素的地理信息,而忽略其渲染信息,简化了返回信息。
一个图层的WFS服务查看方法是在Layer Preview页面,选择WFS下的GeoJSON(以JSON数据形式展现要素信息,方便解析),查看该图层的要素信息。

解析的参数为:
http://localhost:28080/geoserver/topp/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=topp:states&maxFeatures=50&outputFormat=application%2Fjson
其中各个参数意义可以参照此篇文章:http://www.cnblogs.com/naaoveGIS/p/5508882.html
这个请求,查询的是此图层的全量数据(返回要素数量受maxFeatures参数限制),我们可以添加过滤条件,得到我们想要的数据(非常强大的功能,可以实现非常多的地理查询操作),下面我就以几个空间查询的例子来举例说明一下。
1、划分区域,查询区域内的点
http://localhost:28080/geoserver/sf/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=sf:bugsites&maxFeatures=50&outputFormat=application%2Fjson&filter= the_geom 604264,4919992 604340,4913350 611059,4915487 604264,4919992 空间关系

参数说明
A:此次采取的几何方式是Intersects,即采用面与点相交,得到这个面里面的点数据
B:多边形经纬度为一个数组,第一个点经纬度要与最后一个点一致,保证多边形的闭合
C:过滤条件里有一个PropertyName属性,为必须字段,根据图层的属性来查看,具体查看方式为点击图层,然后点及要查询的图层名称,要素类型的第一个属性,即为该字段的值,过程如下图所示



2、 传入点坐标,查询该点所在的区域信息
http://localhost:28080/geoserver/topp/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=topp:tasmania_water_bodies&maxFeatures=50&outputFormat=application%2Fjson&filter= the_geom 146.200,-42.700 
查询说明:
A:此次采取的几何方式是Intersects,即采用点与面相交,得到包含这个点的面数据
查询结果:

3、 查看被线穿过的区域
http://localhost:28080/geoserver/topp/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=topp:tasmania_water_bodies&maxFeatures=50&outputFormat=application%2Fjson&filter= the_geom 146.62903,-41.85171 147.27448,-42.18130 空间关系
查询结果
下面是所有的空间关系介绍
Name | Arguments | Description |
contains | a:Geometry, b:Geometry | Returns true if the geometry a contains b |
crosses | a:Geometry, b:Geometry | Returns true if a crosses b |
disjoint | a:Geometry, b:Geometry | Returns true if the two geometries are disjoint, false otherwise |
equalsExact | a:Geometry, b:Geometry | Returns true if the two geometries are exactly equal, same coordinates in the same order |
equalsExactTolerance | a:Geometry, b:Geometry, tol:Double | Returns true if the two geometries are exactly equal, same coordinates in the same order, allowing for a tol distance in the corresponding points |
intersects | a:Geometry, b:Geometry | Returns true if a intersects b |
isWithinDistance | a: Geometry, b:Geometry, distance: Double | Returns true if the distance between a and b is less than distance (measured as an euclidean distance) |
overlaps | a: Geometry, b:Geometry | Returns true a overlaps with b |
relate | a: Geometry, b:Geometry | Returns the DE-9IM intersection matrix for a and b |
relatePattern | a: Geometry, b:Geometry, pattern:String | Returns true if the DE-9IM intersection matrix for aand b matches the specified pattern |
touches | a: Geometry, b: Geometry | Returns true if a touches b according to the SQL simple feature specification rules |
within | a: Geometry, b:Geometry | Returns true is fully contained inside b |
【server@geoserver】geoserver服务部署和mysql 数据库图层服务发布
【server@supermap】SuperMap iserver 部署和服务发布
【server@geoserver】geoserver 栅格图发布成切片服务
【server@arcgis】ArcGIS server 重新创建Site
【server@geoserver】GeoServer 常用插件
【server@geoserver】GeoServer 矢量切片服务发布
【server@geoserver】WFS只读(readonly)解决办法
【server@geoserver】CQL and ECQL cql_filter例子
Leaflet入门系列
leaflet 入门系列 hello world
Leaflet入门系列 图层管理控件
Leaflet入门系列 比例尺控件Scale
Leaflet入门系列 Zoom控件
Leaflet入门系列 属性控件
Leaflet入门系列 图标(marker) 样式和事件处理
LeafLet入门系列 图标(marker)属性配置
Leaflet入门系列 popup
LeafLet入门系列 常用插件
LeafLet入门系统 加载wkt文件
LeafLet入门系列 GeoJSON图层
LeafLet入门系列 加载矢量切片
LeafLet入门系列 借助 turfjs 绘制点线面缓冲区
LeafLet入门系列 leaflet 常用插件
LeafLet入门系列 调用百度瓦片地图服务
END
请:右下点在看
,右上点【···】分享

关注我
发现更多精彩

5485

被折叠的 条评论
为什么被折叠?



