当前位置: 首页 > news >正文

前端解析超图的iserver xml

前端解析超图的iserver xml

        const res = await axios.get(url)const xmlDom = new DOMParser().parseFromString(res.data, 'text/xml');// 获取versionconst version = xmlDom.getElementsByTagNameNS('*', 'ServiceTypeVersion')[0].textContent// 获取layerconst layerDom = xmlDom.getElementsByTagNameNS('*', 'Layer')[0]const layer = layerDom.getElementsByTagNameNS('*', 'Identifier')[0].textContent// 获取styleconst styleDom = layerDom.getElementsByTagNameNS('*', 'Style')[0]const style = styleDom.getElementsByTagNameNS('*', 'Identifier')[0].textContent// 获取formatconst format = layerDom.getElementsByTagNameNS('*', 'Format')[0].textContent// 获取crsconst crsBoundingBox = layerDom.getElementsByTagNameNS('*', 'BoundingBox')[1]const crs = crsBoundingBox.attributes.crs.value// 获取TileMatrixSetconst TileMatrixSetBox = layerDom.getElementsByTagNameNS('*', 'TileMatrixSet')[2]const TileMatrixSet = TileMatrixSetBox.textContent// 获取serviceUrlconst ResourceURL = layerDom.getElementsByTagNameNS('*', 'ResourceURL')[0]const serviceUrl = ResourceURL.attributes.template.value.replace('{TileMatrixSet}', TileMatrixSet)// 获取四至const boundingBox = layerDom.getElementsByTagNameNS('*', 'BoundingBox')[0]const lowerCorner = boundingBox.getElementsByTagNameNS('*', 'LowerCorner')[0].textContentconst upperCorner = boundingBox.getElementsByTagNameNS('*', 'UpperCorner')[0].textContentconst xMin = parseFloat(lowerCorner.split(' ')[0])const yMin = parseFloat(lowerCorner.split(' ')[1])const xMax = parseFloat(upperCorner.split(' ')[0])const yMax = parseFloat(upperCorner.split(' ')[1])
http://www.lryc.cn/news/504849.html

相关文章:

  • LocalForage 使用指南:统一管理 LocalStorage、WebSQL 和 IndexedDB
  • 代码随想录算法训练营第五天-哈希-242.有效的字母异位词
  • 学习maven(maven 项目模块化,继承,聚合)
  • KDD 2025预讲会:10位一作的论文分享与话题思辨|12月18日全天直播
  • 掌握特征提取:机器学习中的 PCA、t-SNE 和 LDA模型
  • JAVA基础:注释
  • 从源码构建安装Landoop kafka-connect-ui
  • 【自动驾驶】Ubuntu22.04源码安装Autoware Core/Universe
  • 使用Nexus3搭建npm私有仓库
  • OpenHarmony和OpenVela的技术创新以及两者对比
  • 【LeetCode每日一题】Leetcode 1071.字符串的最大公因子
  • 《C++:计算机视觉图像识别与目标检测算法优化的利器》
  • 大模型的构建与部署(2)——数据清洗
  • 试题转excel;word转excel;大风车excel
  • 微信小程序webview和小程序通讯
  • ChatGPT大模型 创作高质量文案的使用教程和案例
  • Vue Web开发(八)
  • element-ui实现table表格的嵌套(table表格嵌套)功能实现
  • 【考前预习】4.计算机网络—网络层
  • 【java】MDC
  • Android 好的开源库
  • Go 语言结构
  • 【漆学军】MT5几个重要类库的使用例子
  • 在 Ubuntu 24.04.1 LTS (WSL) 中使用 openssl 生成 keybox.xml
  • 【JavaSE基础】第十六章:IO流
  • 常见漏洞—SSRF_FastCGI
  • LeetCode 283.移动零(超简单讲解)
  • GIS原理及应用、地理坐标系与投影坐标系
  • 用github镜像加速, --recursive还是去github站怎么处理?
  • ctfshow-web 151-170-文件上传