WMS GetFeatureInfo (Layers)——WMS获取要素信息(图层)
来源:互联网 发布:淘宝宝贝口袋在哪 编辑:程序博客网 时间:2024/06/01 09:26
All features:6Hotel features:2Restaurant features:
4
Demonstrates the use of the layers
option in the ol.format.WMSGetFeatureInfo
format object, which allows features returned by a single WMS GetFeatureInfo request that asks for more than one layer to be read by layer name.
在ol.format.WMSGetFeatureInfo格式对象中演示layers设置的使用,这允许要素返回单个WMS GetFeatureInfo请求,这个请求可以通过图层的名称来访问多个图层。
代码:
<!DOCTYPE html><html> <head> <title>WMS GetFeatureInfo (Layers)</title> <link rel="stylesheet" href="https://openlayers.org/en/v4.2.0/css/ol.css" type="text/css"> <!-- The line below is only needed for old environments like Internet Explorer and Android 4.x --> <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script> <script src="https://openlayers.org/en/v4.2.0/build/ol.js"></script> </head> <body> <table id="info"> <tr> <td>All features:</td> <td id="all"></td> </tr> <tr> <td>Hotel features:</td> <td id="hotel"></td> </tr> <tr> <td>Restaurant features:</td> <td id="restaurant"></td> </tr> </table> <script> // 获取请求 fetch('https://openlayers.org/en/v4.2.0/examples/data/wmsgetfeatureinfo/osm-restaurant-hotel.xml').then(function(response) { return response.text(); }).then(function(response) { // this is the standard way to read the features // 标准的方式来读取要素 // 返回所有要素 var allFeatures = new ol.format.WMSGetFeatureInfo().readFeatures(response); document.getElementById('all').innerText = allFeatures.length.toString(); // when specifying the 'layers' options, only the features of those // layers are returned by the format // 当指定了layer设置的时候,只有这些图层的要素按照格式返回 // 返回hotel图层的要素 var hotelFeatures = new ol.format.WMSGetFeatureInfo({ layers: ['hotel'] }).readFeatures(response); document.getElementById('hotel').innerText = hotelFeatures.length.toString(); // 返回restaurant图层的要素 var restaurantFeatures = new ol.format.WMSGetFeatureInfo({ layers: ['restaurant'] }).readFeatures(response); document.getElementById('restaurant').innerText = restaurantFeatures.length.toString(); }); </script> </body></html>
阅读全文
0 0
- WMS GetFeatureInfo (Layers)——WMS获取要素信息(图层)
- WMS GetFeatureInfo (Image Layer)——WMS获取要素信息(图像图层)
- WMS GetFeatureInfo (Tile Layer)——WMS获取要素信息(瓦片图层)
- 自定义 WMS GetFeatureInfo 响应
- openlayer加载WMS图层例子(LAYERS对应值填的是name属性)
- MapServer 之 发布 WMS GetFeatureInfo 服务
- qgis加载geoserver wms图层
- OpenLayers3 学习心得(六)——WMS服务
- OGC——WMS详细介绍(arcgis server举例)
- OpenLayers+天地图+Geoserver+WMS图层服务
- OpenLayers-2.13.1 WMS图层缓存设置
- 移动GIS——WMS WFS WPS
- 怎样使GeoServer在WMS的GetFeatureInfo请求返回JSON格式数据
- Android6.0 WMS(三) WMS窗口次序
- Android6.0 WMS(四) WMS中常用变量分析
- Android6.0 WMS(六) WMS动画管理
- 天地图+GeoServer WMS图层样例
- 基于Asp.Net的WMS客户端获取
- Notepad++快捷键运行Python
- Linux通过SSH访问中文乱码问题(以secureCRT为例)
- spring-mvc jsp表单提交 不同POJO的相同属性[同名参数]
- JS实现为控件添加倒计时功能
- Eclipse取消或者关闭tomcat所有自动发布(部署)方法
- WMS GetFeatureInfo (Layers)——WMS获取要素信息(图层)
- Common Beanutils的简易理解
- HTML5 -img video flash等 在table 的td中有空隙问题
- idea 使用快捷键
- iOS响应式架构
- 损失函数 center_loss triplet loss
- zookeeper的启动方式
- 设计4个线程,其中两个线程每次对j增加1,另外两个线程对j每次减少1。
- 解决bootstrap中glyphicon无法显示图标只显示方框的问题