leaflet 怎么加载大地2000坐标系地图服务

0 投票
leaflet 怎么加载大地2000坐标系地图服务

proj4.defs("EPSG:4525","+proj=tmerc +lat_0=0 +lon_0=111 +k=1 +x_0=37500000 +y_0=0 +ellps=GRS80 +units=m +no_defs");
 var crs1 = new L.Proj.CRS("EPSG:4525","+proj=tmerc +lat_0=0 +lon_0=111 +k=1 +x_0=37500000 +y_0=0 +ellps=GRS80 +units=m +no_defs");
             
    var host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";
    var map, infoWin, url =  "http://127.0.0.1:8090/iserver/services/map-test/rest/maps/X12003G2018M420500_JSYDGZQ";
   map = L.map('map', {
        preferCanvas: true,
         crs: crs1,
        center: {lon: 37519518.77, lat:  3400229.47},
        maxZoom: 18
       
    });
    L.supermap.tiledMapLayer(url).addTo(map);

加载地图不成功显示
1月 3 分类:  1303次浏览 | 用户: bryant 才疏学浅 (19 分)

1个回答

0 投票

你好,定义投影可以尝试以下代码,你已经用proj4.defs定义了5425了,在定义投影的时候请用以下格式,还有中心的位置,和地图范围,可以在iserver发布的地图服务中查找到, 附上apihttp://iclient.supermapol.com/web/apis/leaflet.html

var crs =L.Proj.CRS("EPSG:5425",{
         origin: [-180,90],
         scaleDenominators: [2000,1000,500,200,100,50,20,10],
   });
   var map=L.map('map', {
      crs: crs
     ...
   })
1月 3 用户: 阳俊林 学富五车 (793 分)
origin: [367387072,3161203.1],

Proj4js.defs("EPSG:4547","+proj=tmerc +lat_0=0 +lon_0=114 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs");
    var crs = L.Proj.CRS("EPSG:4547", {
        origin:[367387.71,3161203.04 ],
        resolutions: [86.03597249425798, 43.01798624712899, 21.508993123564494, 10.754496561782247, 5.3772482808911235, 2.6886241404455617, 1.3443120702227809, 0.6721560351113904, 0.3360780175556952, 0.1680390087778476, 0.0840195043889238, 0.0420097521944619, 0.02100487609723095, 0.010502438048615476, 0.005251219024307738, 0.002625609512153869],
        dpi:96
    });

    map = L.map('map', {
        crs: crs,
        center: [28.3658186772855,112.825836256082],
        zoom: 6
    });
    L.supermap.tiledMapLayer("http://localhost:8092/iserver/services/map-test2000/rest/maps/GISDATA").addTo(map);

上面用的iserver是9.0.1a,建议使用最新的911iserver

代码来自于超图支持工程师刘美玲,特此感谢

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>map for dadao</title>
<script src="dist/leaflet/include-leaflet.js"></script>
<script>
Proj4js.defs("EPSG:4524","+proj=tmerc +lat_0=0 +lon_0=114 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs");
var crs = L.Proj.CRS("EPSG:4524", {
        origin:[36050810.27,3656896.86],
		scaleDenominators: [100000000,50000000,20000000,10000000,5000000,2000000]
    });
var map,url = "http://localhost:8090/iserver/services/map-test/rest/maps/line@test";
function onPageLoad(){
map = L.map('myMap', {
        crs: crs,
        center: [109.51,31.5],
        zoom: 0
    });
    L.supermap.tiledMapLayer(url).addTo(map);
	console.log(L.supermap);
}
</script>
</head>
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;" onload="onPageLoad();" >
<div id="myMap" style="margin:0 auto;width: 100%;height: 100%">
</body>
</html>

我的数据在idesktop里面都是可以查看的,但是自己写的页面调用不到,能否帮我解决下呢?

origin值也需要改成经纬度坐标
origin值也改成经纬度坐标也还是不行,可能是其他原因吗?
...