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

【02】mapbox js api加载arcgis切片服务

需求:

第三方的mapbox js api加载arcgis切片服务,同时叠加在mapbox自带底图上

效果图:

形如这种地址去加载:

http://zjq2022.gis.com:8080/demo/loadmapbox.html

arcgis切片服务参考链接思路:【01】mapbox js api加载arcgis切片服务-CSDN博客

加载代码:

<!DOCTYPE html>
<html><head><meta charset="utf-8" /><title>mapbox 添加arcgis rest切片地图服务</title><metaname="viewport"content="initial-scale=1,maximum-scale=1,user-scalable=no"/><script src="https://api.mapbox.com/mapbox-gl-js/v2.15.0/mapbox-gl.js"></script><linkhref="https://api.mapbox.com/mapbox-gl-js/v2.15.0/mapbox-gl.css"rel="stylesheet"/><script src="https://cdn.bootcdn.net/ajax/libs/axios/0.19.2/axios.js"></script><style>body {margin: 0;padding: 0;}#map {position: absolute;top: 0;bottom: 0;width: 100%;}</style></head><body><div id="map"></div><script>mapboxgl.accessToken ="pk.eyJ1IjoibHh0aWFudGlhbiIsImEiOiJjaXd2ZjlkYnQwMTZvMnRtYWZnM2lpbHFvIn0.ef3rFZTr9psmLWahrqap2A";var map = new mapboxgl.Map({container: "map", // container idstyle: "mapbox://sprites/mapbox/streets-v8",center: [114.32021, 30.578322], // starting positionzoom: 12, // starting zoomminZoom: 1,maxZoom: 18,});map.on("load", function () {map.addSource("arcgissource", {type: "raster",tiles: ["https://ncportal.geoscene.cn/server/rest/services/wuhan3857/MapServer/tile/{z}/{y}/{x}",],tileSize: 256,});map.addLayer({id: "tdt-img-tiles",type: "raster",minzoom: 0,maxzoom: 19,source: "arcgissource",});});// // 添加argis rest 动态地图服务// map.on("load", function () {//   map.addSource("city-source", {//     type: "raster",//     tiles: [//       "https://whgeoscene.hygt.com/server/rest/services/全国道路/MapServer/export?dpi=96&transparent=true&format=png8&layers=&bbox={bbox-epsg-3857}&f=image&bboxSR=102100&imageSR=102100",//     ],//     // 'tiles':['http://localhost:6080/arcgis/rest/services/MyMapService/MapServer/export?dpi=96&transparent=true&format=png8&layers=&bbox={bbox-epsg-3857}&f=image&bboxSR=3857&imageSR=3857'],//     // "tiles": ['http://221.239.0.144:6080/arcgis/rest/services/oceanname_vector/MapServer/export?bbox={bbox-epsg-3857}&f=image&transparent=true&format=png8&bboxSR=102100&imageSR=102100'],//     tileSize: 256,//   });//   map.addLayer({//     id: "sity-layer",//     type: "raster",//     source: "city-source",//   });// });</script></body>
</html>

http://www.lryc.cn/news/286267.html

相关文章:

  • Vue四个阶段,八个钩子函数
  • rancher和k8s接口地址,Kubernetes监控体系,cAdvisor和kube-state-metrics 与 metrics-server
  • idea编译打包前端vue项目
  • Unity中URP下的 额外灯 逐像素光 和 逐顶点光
  • 《WebKit 技术内幕》学习之五(2): HTML解释器和DOM 模型
  • Redis实战之-分布式锁-redission
  • 离线数据仓库-关于增量和全量
  • 09 STM32 - PWM
  • 三勾点餐系统java+springboot+vue3,开源系统小程序点餐系统
  • 《WebKit 技术内幕》学习之五(1): HTML解释器和DOM 模型
  • 小程序学习-21
  • Spring第七天(AOP)
  • 【0247】PG内核checkpoint实现机制分析(2)
  • 单例模式分享
  • Linux查找日志常用命令
  • 中国国际光伏展
  • openai assistants api接入微信机器人,实现类GPTs功能
  • 性能优化-OpenCL kernel 开发
  • systick定时器
  • Unity学习-逐帧图集动画制作
  • 鸿蒙使用第三方SO库
  • 宝塔FTP文件传输服务结合cpolar内网穿透实现远程连接本地服务
  • 【ARMv8M Cortex-M33 系列 7.4 -- 如何使能 usagefault | memmange fault | bus fault 中断】
  • Android Studio安卓开发--ListView学习整理
  • hyperf 和 laravel、lumen防止xss攻击中间件封装
  • flask web 学习之用户认证与会话管理
  • 更改wpf原始默认按钮的样式
  • 【协议】HTTP、HTTPS和HTTP2.0学习总结
  • [数据结构]顺序表
  • 北斗卫星为野外科考人员提供安全保障