首页 / 浏览问题 / WebGIS / 问题详情
iClient for Leaflet 加载4490坐标系服务失败
5EXP 2024年03月25日
报错。No projection definition for code EPSG:4490 var url = "http://localhost:8090/iserver/services/map-test/rest/maps/w_bpc%40localhost_gisdata"; const defs =proj4.defs("EPSG:4490","+proj=longlat +ellps=GRS80 +no_defs +type=crs"); // 定义坐标系 const crs4490 = new CRS( 'EPSG:4490', { def: defs, origin: [-180, 90], resolutions: [ 1.40625, 0.703125, 0.3515625, 0.17578125, 0.087890625, 0.0439453125, 0.02197265625, 0.010986328125, 0.0054931640625, 0.00274658203125, 0.001373291015625, 6.866455078125E-4, 3.4332275390625E-4, 1.71661376953125E-4, 8.58306884765625E-5, 4.291534423828125E-5, 2.1457672119140625E-5, 1.0728836059570312E-5, 5.364418029785156E-6, 2.682209064925356E-6, 1.3411045324626732E-6 ] } )

1个回答

你好,Leaflet加载4490坐标系,需要先引入Proj4js库,再定义4490坐标系,最后设置坐标系参数后加载地图显示,详细说明可以参考技术博客:https://blog.csdn.net/supermapsupport/article/details/101348811

示例代码参考,可在官网(https://iclient.supermap.io/examples/leaflet/examples.html#iServer)示例代码粘贴运行查看效果:

<!--********************************************************************
* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
*********************************************************************-->
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title data-i18n="resources.title_tiledMapLayer4326"></title>
    <script type="text/javascript" src="../js/include-web.js"></script>
  </head>
  <body style="margin: 0; overflow: hidden; background: #fff; width: 100%; height: 100%; position: absolute; top: 0">
    <div id="map" style="margin: 0 auto; width: 100%; height: 100%"></div>
    <script type="text/javascript" include='proj4' src="../../dist/leaflet/include-leaflet.js"></script>
    <script type="text/javascript">
        //定义4490坐标系
        proj4.defs("EPSG:4490","+proj=longlat +ellps=GRS80 +no_defs");
        var url = "https://iserver.supermap.io/iserver/services/map-china400/rest/maps/China_4490";
        //定义坐标系参数
        var crs =L.Proj.CRS("EPSG:4490",{
	           bounds: L.bounds([-180,-85.05112877996838], [180,85.05112877996834]),
	            origin:[-180,85.05112877996834],
	        });
        var map = L.map('map', {
	          	crs: crs,
	            center:[7.910156223922968,0.7031249925492489], 
	            maxZoom: 5,
	            zoom: 0
	        });
	    //加载地图
        L.supermap.tiledMapLayer(url, {noWrap: true}).addTo(map);
    </script>
  </body>
</html>

3,750EXP 2024年03月25日
...