Cesium对WMS地图服务进行查询并弹框展示信息

news2025/1/21 21:52:58

一、简介

Cesium加载WMS地图服务,然后调用接口GetFeatureInfo对要素信息进行查询

二、测试接口


{
    type: "Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon",
    coordinates: 数组
}
查询点
http://123.56.67.147:8080/geoserver_gis/tiger/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&FORMAT=image%2Fpng&TRANSPARENT=true
&QUERY_LAYERS=tiger%3Apoi&STYLES&LAYERS=tiger%3Apoi&exceptions=application%2Fvnd.ogc.se_inimage
&INFO_FORMAT=application%2Fjson&FEATURE_COUNT=50&X=50&Y=50&SRS=EPSG%3A4326&WIDTH=101&HEIGHT=101
&BBOX=-74.01160955429077%2C40.70826172828674%2C-74.00944232940674%2C40.710428953170776

http://icenter.geovis.online/geoserverplus/icenter/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=icenter:%E4%BC%81%E4%B8%9A_%E7%82%B9-PNG-4326-%E6%8D%A2%E8%A1%8C&maxFeatures=50&outputFormat=application%2Fjson
http://172.16.223.165:8080/geoserver/twins/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=twins%3Apoi&maxFeatures=50&outputFormat=application%2Fjson&srsName=EPSG:4326

{
	"type": "FeatureCollection",
	"features": [{
		"type": "Feature",
		"id": "poi.1",
		"geometry": {
			"type": "Point",
			"coordinates": [-74.0104611, 40.70758763]
		},
		"geometry_name": "the_geom",
		"properties": {
			"NAME": "museam",
			"THUMBNAIL": "pics/22037827-Ti.jpg",
			"MAINPAGE": "pics/22037827-L.jpg"
		}
	}, {
		"type": "Feature",
		"id": "poi.2",
		"geometry": {
			"type": "Point",
			"coordinates": [-74.01083751, 40.70754684]
		},
		"geometry_name": "the_geom",
		"properties": {
			"NAME": "stock",
			"THUMBNAIL": "pics/22037829-Ti.jpg",
			"MAINPAGE": "pics/22037829-L.jpg"
		}
	}, {
		"type": "Feature",
		"id": "poi.3",
		"geometry": {
			"type": "Point",
			"coordinates": [-74.01053024, 40.70938712]
		},
		"geometry_name": "the_geom",
		"properties": {
			"NAME": "art",
			"THUMBNAIL": "pics/22037856-Ti.jpg",
			"MAINPAGE": "pics/22037856-L.jpg"
		}
	}, {
		"type": "Feature",
		"id": "poi.4",
		"geometry": {
			"type": "Point",
			"coordinates": [-74.00857344, 40.71194565]
		},
		"geometry_name": "the_geom",
		"properties": {
			"NAME": "lox",
			"THUMBNAIL": "pics/22037884-Ti.jpg",
			"MAINPAGE": "pics/22037884-L.jpg"
		}
	}, {
		"type": "Feature",
		"id": "poi.5",
		"geometry": {
			"type": "Point",
			"coordinates": [-74.01183158, 40.70852996]
		},
		"geometry_name": "the_geom",
		"properties": {
			"NAME": "church",
			"THUMBNAIL": "pics/22037839-Ti.jpg",
			"MAINPAGE": "pics/22037839-L.jpg"
		}
	}, {
		"type": "Feature",
		"id": "poi.6",
		"geometry": {
			"type": "Point",
			"coordinates": [-74.00153046, 40.71988512]
		},
		"geometry_name": "the_geom",
		"properties": {
			"NAME": "fire",
			"THUMBNAIL": "pics/28640984-Ti.jpg",
			"MAINPAGE": "pics/28640984-L.jpg"
		}
	}],
	"totalFeatures": 6,
	"numberMatched": 6,
	"numberReturned": 6,
	"timeStamp": "2023-09-12T03:31:50.145Z",
	"crs": {
		"type": "name",
		"properties": {
			"name": "urn:ogc:def:crs:EPSG::4326"
		}
	}
}


查询线
http://123.56.67.147:8080/geoserver_gis/tiger/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&FORMAT=image%2Fpng&TRANSPARENT=true
&QUERY_LAYERS=tiger%3Atiger_roads&STYLES&LAYERS=tiger%3Atiger_roads&exceptions=application%2Fvnd.ogc.se_inimage
&INFO_FORMAT=application%2Fjson&FEATURE_COUNT=50&X=50&Y=50&SRS=EPSG%3A4326&WIDTH=101&HEIGHT=101
&BBOX=-73.95326614379883%2C40.78451156616211%2C-73.9185905456543%2C40.81918716430664

{
	"type": "FeatureCollection",
	"features": [{
		"type": "Feature",
		"id": "tiger_roads.2060",
		"geometry": {
			"type": "MultiLineString",
			"coordinates": [
				[
					[-73.937885, 40.803733],
					[-73.936415, 40.803118]
				]
			]
		},
		"geometry_name": "the_geom",
		"properties": {
			"CFCC": "A41",
			"NAME": "E 124th St"
		}
	}, {
		"type": "Feature",
		"id": "tiger_roads.2061",
		"geometry": {
			"type": "MultiLineString",
			"coordinates": [
				[
					[-73.938409, 40.803092],
					[-73.93683, 40.802478]
				]
			]
		},
		"geometry_name": "the_geom",
		"properties": {
			"CFCC": "A41",
			"NAME": "E 123rd St"
		}
	}, {
		"type": "Feature",
		"id": "tiger_roads.2068",
		"geometry": {
			"type": "MultiLineString",
			"coordinates": [
				[
					[-73.93729, 40.801837],
					[-73.935041, 40.800874]
				]
			]
		},
		"geometry_name": "the_geom",
		"properties": {
			"CFCC": "A41",
			"NAME": "E 122nd St"
		}
	}, {
		"type": "Feature",
		"id": "tiger_roads.2069",
		"geometry": {
			"type": "MultiLineString",
			"coordinates": [
				[
					[-73.93683, 40.802478],
					[-73.934561, 40.801515]
				]
			]
		},
		"geometry_name": "the_geom",
		"properties": {
			"CFCC": "A41",
			"NAME": "E 123rd St"
		}
	}, {
		"type": "Feature",
		"id": "tiger_roads.2070",
		"geometry": {
			"type": "MultiLineString",
			"coordinates": [
				[
					[-73.937748, 40.801196],
					[-73.935478, 40.80025]
				]
			]
		},
		"geometry_name": "the_geom",
		"properties": {
			"CFCC": "A41",
			"NAME": "E 121st St"
		}
	}, {
		"type": "Feature",
		"id": "tiger_roads.2100",
		"geometry": {
			"type": "MultiLineString",
			"coordinates": [
				[
					[-73.936415, 40.803118],
					[-73.934145, 40.802073]
				]
			]
		},
		"geometry_name": "the_geom",
		"properties": {
			"CFCC": "A41",
			"NAME": "E 124th St"
		}
	}, {
		"type": "Feature",
		"id": "tiger_roads.5134",
		"geometry": {
			"type": "MultiLineString",
			"coordinates": [
				[
					[-73.93683, 40.802478],
					[-73.936415, 40.803118]
				]
			]
		},
		"geometry_name": "the_geom",
		"properties": {
			"CFCC": "A41",
			"NAME": "3rd Ave"
		}
	}, {
		"type": "Feature",
		"id": "tiger_roads.5135",
		"geometry": {
			"type": "MultiLineString",
			"coordinates": [
				[
					[-73.93729, 40.801837],
					[-73.93683, 40.802478]
				]
			]
		},
		"geometry_name": "the_geom",
		"properties": {
			"CFCC": "A41",
			"NAME": "3rd Ave"
		}
	}, {
		"type": "Feature",
		"id": "tiger_roads.5140",
		"geometry": {
			"type": "MultiLineString",
			"coordinates": [
				[
					[-73.935041, 40.800874],
					[-73.934561, 40.801515]
				]
			]
		},
		"geometry_name": "the_geom",
		"properties": {
			"CFCC": "A41",
			"NAME": "2nd Ave"
		}
	}],
	"totalFeatures": "unknown",
	"numberReturned": 9,
	"timeStamp": "2023-09-12T05:38:36.569Z",
	"crs": {
		"type": "name",
		"properties": {
			"name": "urn:ogc:def:crs:EPSG::4326"
		}
	}
}

查询面
http://123.56.67.147:8080/geoserver_gis/tiger/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&FORMAT=image%2Fpng&TRANSPARENT=true
&QUERY_LAYERS=tiger%3Agiant_polygon&STYLES&LAYERS=tiger%3Agiant_polygon&exceptions=application%2Fvnd.ogc.se_inimage
&INFO_FORMAT=application%2Fjson&FEATURE_COUNT=50&X=50&Y=50&SRS=EPSG%3A4326&WIDTH=101&HEIGHT=101&BBOX=-74.8828125%2C-64.3359375%2C-3.8671875%2C6.6796875
{
	"type": "FeatureCollection",
	"features": [{
		"type": "Feature",
		"id": "giant_polygon.1",
		"geometry": {
			"type": "MultiPolygon",
			"coordinates": [
				[
					[
						[-180, -90],
						[-180, 90],
						[180, 90],
						[180, -90],
						[-180, -90]
					]
				]
			]
		},
		"geometry_name": "the_geom",
		"properties": {}
	}],
	"totalFeatures": "unknown",
	"numberReturned": 1,
	"timeStamp": "2023-09-12T03:01:33.391Z",
	"crs": {
		"type": "name",
		"properties": {
			"name": "urn:ogc:def:crs:EPSG::4326"
		}
	}
}

三、示例源码

<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="./css/common.css">
    <title>
        WMS地图服务点击查询【面图层】
    </title>
    <script src="./js/config.js"></script>
    <script src="./scripts/vue.min.js"></script>
    <script type="text/javascript" src="../anov-gis-sdk/index.js"></script>
    <link rel="stylesheet" href="../anov-gis-sdk/index.css">
</head>

<body>
    <div id="cesiumContainer">
    </div>
</body>

</html>

<script>
    var app = new Vue({
        el: '#cesiumContainer',
        mounted() {
            // let viewer = ANOVGIS.CesiumView.init("cesiumContainer");
            window.viewer = new ANOVGIS.Viewer("cesiumContainer", {
                // imageryProvider: undefined
            });

            // 底图
            viewer.imageryLayers.addImageryProvider(
                ANOVGIS.ImageryLayerFactory.createImageryLayer(ANOVGIS.ImageryType.TDT, {
                    style: "img",
                    key: globalConfig.tdtKey
                }));
            // wms服务
            var layer = ANOVGIS.ImageryLayerFactory.createImageryLayer(ANOVGIS.ImageryType.WMS, {
                rectangle: Cesium.Rectangle.fromDegrees(116.1955337524414, 39.75703811645508, 116.62583923339844, 40.03786087036133),
                url: 'http://172.16.223.165:8080/geoserver/twins/wms?',
                layers: "	twins:architecture",
                parameters: {
                    transparent: true,
                    format: "image/png",
                },
                highlight: {
                    material: 'rgba(255,255,0,0.6)',
                    height: 0.01
                }
            })
            layer.bindPopup({
                viewer: viewer,
                showTitle: true,
                useDefaultHtmlTemplate: true,//用默认模板
            });
            layer.addEventListener(ANOVGIS.MouseEventType.CLICK, (e) => {
                let infoData = {
                    title: e.feature.data.properties.name || '未查到建筑名称',
                    fieldsMap: [
                        {
                            nameC: '建筑层高:',
                            value: e.feature.data.properties.floor
                        }]
                }
                layer.popup.show(e.position, infoData);
                console.log(e);
            })
            var layer1 = viewer.imageryLayers.addImageryProvider(layer);
            viewer.flyTo(layer1)
        }
    });
</script>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1007227.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

智慧公厕构建城市公共厕所中枢网络,民生服务更高效,城市管理更精准

随着城市化进程的加快&#xff0c;城市人口的不断增长&#xff0c;城市公共厕所问题愈发凸显。大量的人口涌入&#xff0c;公厕资源的不足、管理的不到位&#xff0c;已经成为困扰城市发展的一大难题。然而&#xff0c;智慧公厕的出现&#xff0c;为解决这一问题提供了新的思路…

2023-09-12 LeetCode每日一题(课程表 IV)

2023-03-29每日一题 一、题目编号 1462. 课程表 IV二、题目链接 点击跳转到题目位置 三、题目描述 你总共需要上 numCourses 门课&#xff0c;课程编号依次为 0 到 numCourses-1 。你会得到一个数组 prerequisite &#xff0c;其中 prerequisites[i] [ai, bi] 表示如果你…

这泼天的富贵,轮到数字化转型升级的企业了

数字化转型是建立在现代信息技术上&#xff0c;利用数字化的一切相关技术创建一种新的、或者对已有的商业模式进行重塑&#xff0c;以此来满足时代变化中传统的业务和市场进行变革。 数字化转型 - 派可数据BI可视化分析平台 出现这种变革是因为经过几十年的经济发展&#xff0…

怎么合并pdf文件到一起?快点过来尝试一下吧

怎么合并pdf文件到一起&#xff1f;pdf文件的使用越来越频繁&#xff0c;相信每个小伙伴都有这样的感受&#xff0c;不管是网上下载到的文件资料&#xff0c;还是合作伙伴发送过来的合作意向书&#xff0c;基本上都会做成pdf格式的文件&#xff0c;因为pdf文件具有更强的稳定性…

记账app排行榜前十名,第2个开店必备!

工欲善其事必先利其器&#xff0c;不管是开店做生意的老板还是个人&#xff0c;想要管理好自己的财富&#xff0c;第一步就是要坚持记账。 现在市面上的记账App有很多&#xff0c;我们选取了秦丝进销存、随手记、智慧记等10款比较有代表性的记账APP&#xff0c;其中有几个是专…

webpack自定义loader解析指定后缀名文件

案例&#xff1a; webpack自定义loader解析.chenjiang后缀名的文件 整体目录&#xff1a; chenjiangLoader.js文件代码 // 正则匹配script标签中的内容 const REG /<script>([\s\S]*)<\/script>/;module.exports function (source) {const __source source.…

拼多多手势验证

国内的好像并没有出现这种&#xff0c;一般都是在海外注册&#xff0c;或者发信才会有。各位大哥想研究的话得需要挂vpn了。 拼多多手势的轨迹其实咋说&#xff0c;难倒是不难&#xff0c;反正要你准确按这个线条描绘出不间断的数据。 它这识别的话&#xff0c;跟狗东的那个还…

运维学习之部署Grafana

sudo nohup wget https://dl.grafana.com/oss/release/grafana-10.1.1.linux-amd64.tar.gz &后台下载压缩包&#xff0c;然后按一下回车键。 ps -aux | grep 15358发现有两条记录&#xff0c;就是还在下载中。 ps -aux | grep 15358发现有一条记录&#xff0c;并且tail …

【03】Charles_ mock服务端返回数据Maplocal

目录 1.适用场景 2.操作方法 3.实现效果 1.适用场景 功能描述&#xff1a; 拦截客户端发出的接口请求&#xff0c;使用本地文档内容&#xff0c;替代服务端返回值。可以使用断点方式&#xff0c;但是断点操作容易超时。 我们可以随时更改本地文档的内容&#xff0c;来模拟各…

提醒一个xampp启动mysql创建函数存在的坑

一直以来本地搭建的项目为了方便我都是使用xampp作为mysql的管理工具&#xff0c;比较简洁可视化比较好。但是最近程序的一个报错暴露了他与mysql之间的一些问题。 使用自增序列nextval函数时&#xff0c;突然抛出来一句&#xff1a; select nextval( SEQ_REGISTER_ID) > …

代码随想录 -- day50 -- 123.买卖股票的最佳时机III 、188.买卖股票的最佳时机IV

123.买卖股票的最佳时机III 动态规划&#xff1a; 关键在于至多买卖两次&#xff0c;这意味着可以买卖一次&#xff0c;可以买卖两次&#xff0c;也可以不买卖。 一天一共就有五个状态&#xff0c; 没有操作 &#xff08;其实我们也可以不设置这个状态&#xff09;第一次持…

微信怎么定时发圈?

定时发圈的妙用 在合适的时间点发布新的产品、促销活动&#xff0c;不仅能够及时提醒用户品牌的存在&#xff0c;还可以引发用户的兴趣&#xff0c;增加品牌的曝光率。 选择最佳的发朋友圈时间段&#xff0c;以确保推广内容得到最大的曝光和关注&#xff0c;提高广告投放的效果…

推进“数智+数治”,中期科技智慧公厕驱动城市公厕更新升级发展

随着城市化的快速发展和人口的不断增加&#xff0c;公共厕所这一基础设施的更新升级成为了亟待解决的问题。过去的传统公厕往往存在着环境脏乱差、无法保证使用者的舒适度等诸多问题。而智慧公厕则能够通过互联网和物联网的技术手段&#xff0c;实现智能化的运行管理&#xff0…

微信小程序 封装请求api

封装请求地址 https.js let baseUrlhttps://XX.XXX.com/index.php/; //自己得服务器地址export {baseUrl}结构目录 封装 request.js import { baseUrl } from ./https.jsmodule.exports {request : function(url, methodType, data){let fullUrl ${baseUrl}${url}// let tok…

mmap详解

想写一篇文章&#xff0c;详细的介绍一下mmap&#xff0c;主要是原理、用法、mmap泄露来进行介绍。说到mmap&#xff0c;首先得从堆空间说起。 申请堆空间 其实&#xff0c;不管是 32 位系统还是 64 位系统&#xff0c;内核都会维护一个变量 brk&#xff0c;指向堆的顶部&…

element-ui框架的el-dialog弹出框被遮罩层挡住了/el-drawer....会生成v-model元素的组件被遮罩层挡住

element-ui框架的el-dialog弹出框被遮罩层遮挡问题_前端李十三的博客-CSDN博客可以发现el-dialog 组件显示的时候被遮罩层挡住了。https://blog.csdn.net/weixin_64530670/article/details/131173159?ydrefereraHR0cHM6Ly9tcC5jc2RuLm5ldC9tcF9ibG9nL21hbmFnZS9hcnRpY2xlP3Nwb…

KubeSphere 在互联网医疗行业的应用实践

作者&#xff1a;宇轩辞白&#xff0c;运维研发工程师&#xff0c;目前专注于云原生、Kubernetes、容器、Linux、运维自动化等领域。 前言 2020 年我国互联网医疗企业迎来了“爆发元年”&#xff0c;越来越多居民在家隔离期间不方便去医院看诊&#xff0c;只好采取在线诊疗的手…

USB接口针式打印机

1 针式打印机原理 - 针式打印机16针是纵向排列&#xff0c;每次打印垂直的16bit&#xff0c;然后右移一bit&#xff0c;继续下列打印&#xff1b;字节的MSB表示最上面的点&#xff0c;字节LSB表示最下面的点 - 由于汉字字模的点阵是横向排列的&#xff0c;而提供给打印头的信息…

java.lang.NoSuchMethodError: java.lang.reflect.Field.trySetAccessible()Z

java.lang.NoSuchMethodError: java.lang.reflect.Field.trySetAccessible()Z 将JDK升级为11即可。 File --Project Structure – SDK Location --Gradle Setting --Gradle JDK 选择11

HTML、CSS和JavaScript的实践代码2

今天我将为你带来一个关于HTML、CSS和JavaScript的实践代码&#xff0c;这将展示如何创建一个漂亮的计数器。 首先&#xff0c;让我们创建一个HTML文件&#xff0c;并命名为index.html&#xff1a; <!DOCTYPE html> <html> <head><title>计数器</…