geoserver热图

2023-05-16

1.参考

GeoServer发布Heatmap - wenglabs - 博客园

Rendering Transformations — GeoServer 2.21.x User Manual

2.下载 GeoServer 及wps插件,该插件gs:heatmap支持热图样式

3.发布测试shp

geoserver热图测试数据-其它文档类资源-CSDN下载

4、添加热图样式,刚才发布的图层设置该样式,注意里面的权重字段

weightAttr为权重字段[0,1]

<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
           xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
    xmlns="http://www.opengis.net/sld"
    xmlns:ogc="http://www.opengis.net/ogc"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <NamedLayer>
        <Name>Heatmap</Name>
        <UserStyle>
            <Title>Heatmap</Title>
            <Abstract>A heatmap surface showing population density</Abstract>
            <FeatureTypeStyle>
                <Transformation>
                    <ogc:Function name="gs:Heatmap">
                        <ogc:Function name="parameter">
                            <ogc:Literal>data</ogc:Literal>
                        </ogc:Function>
                        <ogc:Function name="parameter">
                            <ogc:Literal>weightAttr</ogc:Literal>
                            <ogc:Literal>maxwater</ogc:Literal>
                        </ogc:Function>
                        <ogc:Function name="parameter">
                            <ogc:Literal>radiusPixels</ogc:Literal>
                            <ogc:Function name="env">
                                <ogc:Literal>radius</ogc:Literal>
                                <ogc:Literal>100</ogc:Literal>
                            </ogc:Function>
                        </ogc:Function>
                        <ogc:Function name="parameter">
                            <ogc:Literal>pixelsPerCell</ogc:Literal>
                            <ogc:Literal>10</ogc:Literal>
                        </ogc:Function>
                        <ogc:Function name="parameter">
                            <ogc:Literal>outputBBOX</ogc:Literal>
                            <ogc:Function name="env">
                                <ogc:Literal>wms_bbox</ogc:Literal>
                            </ogc:Function>
                        </ogc:Function>
                        <ogc:Function name="parameter">
                            <ogc:Literal>outputWidth</ogc:Literal>
                            <ogc:Function name="env">
                                <ogc:Literal>wms_width</ogc:Literal>
                            </ogc:Function>
                        </ogc:Function>
                        <ogc:Function name="parameter">
                            <ogc:Literal>outputHeight</ogc:Literal>
                            <ogc:Function name="env">
                                <ogc:Literal>wms_height</ogc:Literal>
                            </ogc:Function>
                        </ogc:Function>
                    </ogc:Function>
                </Transformation>
                <Rule>
                    <RasterSymbolizer>
                        <!-- specify geometry attribute to pass validation -->
                        <Geometry>
                            <ogc:PropertyName>geom</ogc:PropertyName>
                        </Geometry>
                        <Opacity>0.6</Opacity>
                        <ColorMap type="ramp" >
                            <ColorMapEntry color="#0000FF" quantity="0" label="nodata" opacity="0"/>
                            <ColorMapEntry color="#00FFFF" quantity="0.02" label="nodata" opacity="0"/>
                            <ColorMapEntry color="#00FF00" quantity=".1" label="nodata"/>
                            <ColorMapEntry color="#FFFF00" quantity=".5" label="values" />
                            <ColorMapEntry color="#FF0000" quantity="1" label="values" />
                        </ColorMap>
                    </RasterSymbolizer>
                </Rule>
            </FeatureTypeStyle>
        </UserStyle>
    </NamedLayer>
</StyledLayerDescriptor>

5.前端demo

<!doctype html>
<html lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>热图</title>
		<link rel="stylesheet"
			href="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.9.0/css/ol.css"
			type="text/css">
		<style>
			html,
			body,
			.map {
				height: 100%;
				width: 100%;
				margin: 0;
				padding: 0
			}
		</style>
	</head>
	<body>
		<div id="map" class="map"></div>
	</body>
	<script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.9.0/build/ol.js"></script>
	<script>
		var gaodeMapLayer = new ol.layer.Tile({
			source: new ol.source.XYZ({
				url: 'http://t0.tianditu.com/vec_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=vec&tileMatrixSet=w&TileMatrix={z}&TileRow={y}&TileCol={x}&style=default&format=tiles&tk=40b190683706230fade806c1ac8c14e8'
				// url: 'http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scl=2&style=7&x={x}&y={y}&z={z}'
			}),
			visible: true
		});

		/**
		 * 创建地图对象并添加图层
		 */
		var map = new ol.Map({
			target: 'map',
			controls: ol.control.defaults({
				zoom: false
			}),
			layers: [gaodeMapLayer],
			view: new ol.View({
				center: transform([108.948301, 34.223445]),
				// center: [108.948301, 34.223445],
				// projection: 'EPSG:4326',
				zoom: 14.5,
			})
		});

		function transform(pois) {
			return ol.proj.transform(pois, 'EPSG:4326', 'EPSG:3857')
		}

		var base_url = 'http://localhost:8080/geoserver';
		new ol.layer.Image({
			source: new ol.source.ImageWMS({
				url: base_url + "/test/wms",
				params: {
					VERSION: '1.1.1',
					LAYERS: 'manhole_deep_P1',
					FORMAT: 'image/png',
				}
			}),
			map: map
		});

		// 瓦片有点问题
		new ol.layer.Tile({
			source: new ol.source.TileWMS({
				url: base_url + "/test/wms",
				params: {
					VERSION: '1.1.1',
					LAYERS: 'manhole_deep_P1',
					FORMAT: 'image/png',
					TILED: true
				}
			}),
			// map: map
		})

		// 瓦片有点问题
		new ol.layer.Tile({
			source: new ol.source.XYZ({
				url: base_url + '/gwc/service/wmts?' +
					'layer=test:manhole_deep_P1&style=&tilematrixset=EPSG:900913&' +
					'Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&' +
					'TileMatrix=EPSG:900913:{z}&TileCol={x}&TileRow={y}'
			}),
			visible: true,
			// map: map
		});
	</script>
</html>

6、最后效果

wms正常

瓦片却不正常,哪位同学指教下。

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

geoserver热图 的相关文章

随机推荐

  • Xftp6如何连接虚拟机(Ubuntu)Windows与虚拟机之间传输文件

    一 安装Ubuntu ssh出现异常 Err 1 http security ubuntu com ubuntu xenial security main amd64 openssh sftp server amd64 1 7 2p2 4u
  • ubuntu下搭建ftp服务器

    1 安装vsftpd xff0c 安装命令 xff1a sudo apt get install vsftpd 查看是否安装成功 xff1a vsftpd version 2 新建一个文件夹用于FTP的工作目录 xff08 cpucard是
  • 命名空间 std 中没有名为 stoi 的成员

    我正在测试std stoi以下链接中的函数 xff1a 但我收到了错误 xff1a 已经添加了头文件 include lt string gt xff0c 但仍然错误提示 xff1a 在命名空间 std 中没有名为 stoi 的成员 xff
  • Linux+vscode 客户端通过代码操作远程服务器端数据库(MySQL)

    这篇文章解决两个问题 xff1a 1 在Linux系统下使用vscode用C C 43 开发客户端程序时 xff0c 如何调用mysql库函数 xff1b 2 客户端与远程服务器端的MySQL连接时 xff0c 需要做哪些前期准备工作 xf
  • put操作提示 No such file or directory

    https blog csdn net weixin 33875839 article details 86128344
  • IDEA导入lib目录下的jar包

    https blog csdn net u010286027 article details 85248719 ops request misc 61 amp request id 61 amp biz id 61 102 amp utm
  • MIPS、ARM、X86三大架构

    MIPS ARM X86三大架构 RISC平台的发展已经有长达几十年的历史了 其最早诞生于80年代的MIPS主机 xff0c 随着技术的不断发展 xff0c RISC平台的应用领域逐步扩展 xff0c 小到手机 xff0c 大到工控设备都可
  • 报错:Diamond types are not supported at language level ‘6‘

    在编译时报错 xff1a 这主要是1 6版本的javac exe编译器不支持菱形运算符 xff1b 解决办法 xff1a 1 修改设置settings和项目结构Project Structure中的JDK版本设置 配置IDEA编译器版本 2
  • Ubuntu18.04.3虚拟机安装步骤

    Ubuntu18 04 3虚拟机安装步骤 xff08 图文教程 xff0c 非常详细 xff01 xff01 xff01 xff09 丶无殇的博客 CSDN博客 ubuntu18虚拟机安装
  • 信号包络

    将一段时间长度的高频信号的峰值点连线 xff0c 就可以得到上方 xff08 正的 xff09 一条线和下方 xff08 负的 xff09 一条线 xff0c 这两条线就叫包络线 包络线就是反映高频信号幅度变化的曲线 对于等幅高频信号 xf
  • 归一化函数normalize详解

    opencv 2 归一化函数normalize详解 1 归一化定义与作用 归一化 就是要把需要处理的数据经过处理后 xff08 通过某种算法 xff09 限制在你需要的一定范围内 首先归一化是为了后面数据处理的方便 xff0c 其次是保证程
  • 多态性之编译期多态和运行期多态(C++版)

    多态性之编译期多态和运行期多态 C 43 43 版 C 43 43 中最为经典的就是多态性 xff0c 多态性充分体现了面向对象的思想 xff0c 并且是C 43 43 与C的最大区别之一 多态性分为编译期多态和运行期多态 xff0c 也称
  • SVM 原理详解,通俗易懂

    看了该作者的文章 xff0c 瞬间膜拜了 xff01 讲得太好了 xff01 转自 xff1a http www blogjava net zhenandaci category 31868 html xff08 一 xff09 SVM的简
  • 线阵相机学习笔记(一)

    1 GigE Vision GigE Vision是由自动化影像协会AIA Automated Imaging Association 发起指定的一种基于千兆以太网的图像传输的标准 具有传输距离长 xff08 无中继时100米 xff09
  • 如何做一个软件项目经理? ----写给公司所有的开发人员

    第一部分 xff1a 软件项目经理的要求 首先是一个管理者 xff0c 其次熟悉某些工具 xff0c 某几种语言 xff0c 行业背景 xff0c 项目管理技能 软件项目经理面临的恶劣环境 xff0c 我们绝大部分软件企业运行在相对混乱的状
  • vector介绍和基本使用

    文章目录 一 vector介绍二 vector使用 1 constructor 2 iterator 3 capacity 4 Element access 5 Modifiers 三 vector迭代器失效问题 一 vector介绍 ve
  • PELCO(派尔高)协议解析及下载(转载)

    PELCO xff08 派尔高 xff09 协议解析及下载 沈雪瑜 在IBMS接口开发 中 xff0c 我们需要用到一些常用的协议 xff0c 而PELCO 派尔高 的监控器材在我国有很广泛的应用 PELCO有自己的传输控制协议 xff0c
  • STM32&nbsp;HAL库&nbsp;STM3…

    原文地址 xff1a STM32 HAL库 STM32CUBEMX KEIL TIM1 PWM 四路输出可调 一 作者 xff1a 用户2797410335 硬件 xff1a TM32F407VET6 8M晶振 xff0c JLINK JT
  • 海康设备网络SDK开发NET_DVR_GetDeviceConfig

    由于官方的例子中没有关于NET DVR GetDeviceConfig的示例 xff0c 在此记录一下 NET DVR GET FIELD DETECTION 获取区域入侵侦测配置 xff0c 避免其他小伙伴踩坑 这里只记录主要代码 xff
  • geoserver热图

    1 参考 GeoServer发布Heatmap wenglabs 博客园 Rendering Transformations GeoServer 2 21 x User Manual 2 下载 GeoServer 及wps插件 xff0c