首页 / 浏览问题 / WebGIS / 问题详情
WMS加载发布url无法展示地图
2EXP 2022年07月04日

// 地图地址

      let url =

        "http://10.163.204.4:32636//portalproxy/iserver/services/TJVMap_Darkblue/rest/maps/TJVMap_Darkblue?key=1bNC0jAVEfAesGAAsJohliBb";

      // 范围

      let start = L.latLng(116.62, 38.5);

      let end = L.latLng(118.15, 40.25);

      let bounds = L.latLngBounds(start, end);

      // 自定义坐标系

      proj4.defs("EPSG:4490", "+proj=longlat +ellps=GRS80 +no_defs");

      let CRS4490 = L.Proj.CRS(

        "EPSG:4490",

        // "+proj=longlat +ellps=GRS80 +no_defs",

        {

          resolutions: [

            1.40625, //如果是天地图,0级的影像分辨率可以写任意数值

            0.703125,

            0.3515625,

            0.17578125,

          ],

          origin: [-180, 90],

        }

      );

      let map = L.map("map", {

        crs: CRS4490,

        // crs: L.CRS.EPSG3857,

        zoom: 0,

        attributionControl: false,

        zoomControl: false,

        // preferCanvas: true, //使用canvas模式渲染矢量图形

        center: [39.38, 117.38], // 中心点

        bounds: bounds,

      });

      L.tileLayer

        .wms(url, {

          // layers: "China", // 060601 资源名称

          format: "image/png",

          transparent: true,

          crs: CRS4490,

        })

        .addTo(map);

1个回答

您好,您问题里说的是wms服务,但是我看您代码中的地址好像是rest服务的。

leaflet加载wms标准地图服务:http://support.supermap.com.cn:8090/iserver/iClient/forJavaScript/examples/leaflet/editor.html#WMSLayer

leaflet加载记载rest地图服务:http://support.supermap.com.cn:8090/iserver/iClient/forJavaScript/examples/leaflet/editor.html#01_tiledMapLayer4326

希望可以帮助到您。

于丁
1
9,603EXP 2022年07月05日
...