ArcGIS 10.8.1之后发布栅格数据的MapServer 动态工作空间 替换数据源渲染问题

server/2025/3/29 16:12:12/

背景

经过测试,Server 10.8.1、11.0、11.1发布相关服务设置动态空间之后,前端都无法自动读取同名的clr色彩映射表文件进行渲染,服务都是由ArcGIS Pro进行发布。

原因

基于ArcMap发布的服务才支持,但是10.8.1之后不支持ArcMap发布服务。自动读取clr色彩映射表文件,需要ArcMap Runtime后台支持,已废弃,可以加载切换数据源,但是不支持渲染,需要采用新的开发方式。
在这里插入图片描述

首先,如何发布服务并开启动态空间?

通过Pro发布服务后在Manager设置开启即可。
在这里插入图片描述
测试示例代码:

<!DOCTYPE html>
<html lang="zh-CN">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>加载ArcGIS Server服务</title><!-- <link rel="stylesheet" href="https://js.arcgis.com/4.25/esri/themes/light/main.css"><script src="https://js.arcgis.com/4.25/"></script> --><link rel="stylesheet" href="https://js.arcgis.com/4.32/esri/themes/light/main.css" /><script src="https://js.arcgis.com/4.32/"></script><style>#viewDiv {height: 100vh;width: 100%;}</style>
</head>
<body><div id="viewDiv"></div><script>require(["esri/Map","esri/views/MapView","esri/layers/MapImageLayer"], function(Map, MapView, MapImageLayer) {// 创建一个地图实例const map = new Map({basemap: "streets"});// 创建一个地图视图实例const view = new MapView({container: "viewDiv",map: map,center: [120.0916129,30.2487992],zoom: 8});// 定义 token//const tkstr = "iN8hBNamZvCpIeo_-QD-dHAg8afm1y4ZUWuj1RmswuM";// 创建一个动态地图服务图层const dynamicLayer = new MapImageLayer({//url: "http://xxxx:6080/geoscene/rest/services/demstyletest/MapServer",url: "http://xxxx:6080/geoscene/rest/services/demstyletest/MapServer",sublayers: [{id: 0,source: {type: "data-layer",dataSource: {type: "raster",workspaceId: "kkk123",dataSourceName: "aster84.tif"}}}]});// 将地图服务图层添加到地图中map.add(dynamicLayer);});</script>
</body>
</html>

动态空间路径下即使,存放了同名clr色彩映射表,也是不支持读取渲染的。
在这里插入图片描述

在这里插入图片描述

解决方案

1. 导出为 RGB 方案的栅格数据

这种方法主要针对较为固定的成果数据,如果渲染也是动态的则无法满足。

具体方法可以参考:https://www.cnblogs.com/wigis/p/11065631.html

2. 将数据作为在线数据资源,使用ImageTileLayer加载

这种方法主要针对用户查看的栅格数据,tif栅格数据可以放在Tomcat或其他服务器都可以,渲染通过前端设置render控制,示例代码可以参考:

<html><head><meta charset="utf-8" /><meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" /><title>hello</title><style>html,body,#viewDiv {padding: 0;margin: 0;height: 100%;width: 100%;}</style><linkrel="stylesheet"href="https://js.arcgis.com/4.30/esri/themes/light/main.css"/><script src="https://js.arcgis.com/4.30/"></script><script>require(["esri/config","esri/WebMap","esri/views/MapView","esri/views/SceneView","esri/layers/ImageryTileLayer","esri/layers/TileLayer","esri/layers/support/RasterFunction","esri/renderers/RasterShadedReliefRenderer","esri/smartMapping/raster/support/colorRamps","esri/renderers/RasterStretchRenderer","esri/rest/support/MultipartColorRamp","esri/rest/support/AlgorithmicColorRamp","esri/Color",], function(esriConfig,Map, MapView, SceneView,ImageryTileLayer, TileLayer, RasterFunction, RasterShadedReliefRenderer, colorRamps, RasterStretchRenderer, MultipartColorRamp, AlgorithmicColorRamp, Color) {const colorRamp = new MultipartColorRamp({colorRamps: [new AlgorithmicColorRamp({fromColor: new Color([20, 100, 150, 255]),toColor: new Color([70, 0, 150, 255])}),new AlgorithmicColorRamp({fromColor: new Color([70, 0, 150, 255]),toColor: new Color([170, 0, 120, 255])}),new AlgorithmicColorRamp({fromColor: new Color([170, 0, 120, 255]),toColor: new Color([230, 100, 60, 255])}),new AlgorithmicColorRamp({fromColor: new Color([230, 100, 60, 255]),toColor: new Color([255, 170, 0, 255])}),new AlgorithmicColorRamp({fromColor: new Color([255, 170, 0, 255]),toColor: new Color([255, 255, 0, 255])})]});const stretchRenderer = new RasterStretchRenderer({colorRamp: colorRamp,type: "raster-stretch",bandIds: [0], // 使用第一个波段stretchType: "min-max", // 最小值-最大值拉伸statistics: [[0, 255]], // 波段的最小值和最大值gamma: [1] // Gamma 值});let layer = new ImageryTileLayer({url: "http://localhost/data/red.tif",renderer: stretchRenderer})const map = new Map({layers: [layer]});const view = new MapView({map: map,container: "viewDiv"});function updateImageTileLayerUrl(newUrl) {// 移除旧图层map.remove(layer);// 创建新图层let newLayer = new ImageryTileLayer({url: newUrl,renderer: stretchRenderer});// 将新图层添加到地图map.add(newLayer);}let btn = document.getElementById("click")btn.onclick = () => {updateImageTileLayerUrl("http://127.0.0.1:5500/static/fanred.tif")}})</script></head><body><div id="viewDiv"></div><button id="click">change</button></body>
</html>

在这里插入图片描述

2. 发布单景栅格数据的 ImageServer

需要通过代码层面,替换服务下的同名栅格数据源,同样,渲染也需要通过前端renderer控制。可以参考:
https://blog.csdn.net/suntongxue100/article/details/130303795?spm=1011.2415.3001.5331


http://www.ppmy.cn/server/179315.html

相关文章

HarmonyOS NEXT图形渲染体系:重新定义移动端视觉体验

一、革命性架构设计 1.1 多线程并行渲染引擎 HarmonyOS NEXT通过四级流水线并行架构实现渲染效率质的飞跃&#xff0c;其核心包含&#xff1a; 优先级任务调度器&#xff1a;动态分配紧急渲染任务&#xff08;如手势反馈&#xff09;与常规任务智能线程池管理&#xff1a;根…

无人机电调全技术解析:从电路设计、控制原理到运维实战(2025 版)

一、电调核心电路设计解析 1. 核心组件 MOSFET 功率模块&#xff1a; 采用 N 沟道增强型 MOSFET&#xff08;如 IRF3205、FDP3688&#xff09;&#xff0c;导通电阻&#xff08;Rds (on)&#xff09;决定效率&#xff08;典型值 1-10mΩ&#xff09;。并联设计&#xff08;2-…

RabbitMQ学习笔记

RabbitMQ学习笔记 1. 消息队列 1.1 MQ 的相关概念 1.1.1 什么是MQ MQ(message queue)&#xff0c;从字面意思上看&#xff0c;本质是个队列&#xff0c;FIFO 先入先出&#xff0c;只不过队列中存放的内容是 message 而已&#xff0c;还是一种跨进程的通信机制&#xff0c;用…

【Axure高保真原型】表格嵌套卡片

今天和大家分享表格嵌套卡片的原型模版&#xff0c;可以点击加号或减号展开或收起对应部门下的员工卡片信息。这个表格是用中继器制作的&#xff0c;所以使用也很方便&#xff0c;维护中继器表格里的信息&#xff0c;即可自动生成交互效果……具体效果可以打开下方原型地址体验…

ASP.NET Core WebApi+React UI开发入门详解

在前段时间&#xff0c;有粉丝反馈能否写一篇基于ASP.NET Core Web ApiReact UI进行Web开发的文章&#xff0c;经过查阅相关资料&#xff0c;发现Visual Studio 2022已经集成相关模板&#xff0c;可以在Visual Studio中直接创建项目项目&#xff0c;今天以一个小例子&#xff0…

# 03_Elastic Stack 从入门到实践(三)--- 1

03_Elastic Stack 从入门到实践(三)— 1 一、Elasticsearch核心讲解之批量操作 1、Elasticsearch批量操作:批量查询。 有些情况下,可以通过批量操作以减少网络请求。如:批量查询、批量插入数据等。 # 批量查询:post /haoke/user/_mget# 打开 Postman 软件,地址栏输…

debug - 安装.msi时,为所有用户安装程序

文章目录 debug - 安装.msi时&#xff0c;为所有用户安装程序概述笔记试试在目标.msi后面直接加参数的测试 备注备注END debug - 安装.msi时&#xff0c;为所有用户安装程序 概述 为了测试&#xff0c;装了一个test.msi. 安装时&#xff0c;只有安装路径的选择&#xff0c;没…

Vite管理的Vue3项目中monaco editer的使用以及组件封装

文章目录 背景环境说明安装流程以及组件封装引入依赖封装组件 外部使用实现效果 v-model实现原理 背景 做oj系统的时候,需要使用代码编辑器,决定使用Monaco Editor&#xff0c;但是因为自身能力问题&#xff0c;读不懂官网文档&#xff0c;最终结合ai和网友的帖子成功引入&…