首页 / 浏览问题 / 云GIS / 问题详情
leaflet 加载服务器发布的rest 4326地图失败
20EXP 2021年10月18日
<template>
  <div id="map"></div>
</template>

<script>
import L from "leaflet";
import "@supermap/iclient-leaflet";

export default {
  props: {},
  mounted:()=>{
    var map,
      url =
        // "https://iserver.supermap.io/iserver/services/map-world/rest/maps/World";
        "http://123.234.104.58:6080/iserver/services/map-lcld/rest/maps/greenwgs84"
    // var host="https://123.234.104.58:6080"
    // var map, url = host + "/iserver/services/map-world/rest/maps/World";
    map = L.map("map", {
      crs: L.CRS.EPSG4326,
      center: [120.44 , 36.19],
      maxZoom: 18,
      zoom: 1,
    });
    L.supermap.tiledMapLayer(url).addTo(map);
  },
  components: {},
  data() {
    return {};
  },
  methods: {},
};
</script>
<style scoped>
#map {
  margin: 0;
  overflow: hidden;
  background: #fff;
  width: 100%;
  height: 100%;
  position: absolute;
}
</style>

iserver地图是4326坐标系,中心点为

( 120.43 , 36.19 )

报错截图如下:

1个回答

leaflet加载地图中心点是(y, x)结构的,您那边尝试将地图中心点对调下改为(36.19, 120.43)后看能否正常显示。
2,243EXP 2021年10月18日

还是不行 界面一篇空白  但是调试可以看见有一些瓦片数据了 但是预览都是黑的

您这个地图服务在iServer中预览是能正常看到地图的吗?当前没有正常显示出来应该是您的当前设置的显示级别不对,如果是的话可以修改下您的zoom级别。
iserver可以显示地图,设置多大啊
可以根据您当前地图服务的比例尺来判断设置zoom的大小。

比如在iServer中比例尺显示的是 0.000000007526 ,那zoom设置为1或2地图就能正常显示出来;

比例尺显示的越小,zoom设置的越小。
谢谢了 ,搞出来了  。所有地图库的中心点都是(y,x)形式吗  ? openlayer加载我采用的是(x,y)形式 也可以加载出来
在leaflet中设置center是以(y,x)结构的,其他的还是(x,y)。
...