首页 / 浏览问题 / WebGIS / 问题详情
classic百度地图作为地图如何叠加4326坐标系的rest服务?
2EXP 2022年10月28日
classic百度地图作为地图如何叠加iserver发布的4326坐标系的rest服务?

1个回答

类似这样子


<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title data-i18n="resources.title_4326Map"></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" exclude="iclient-classic" src="../../dist/classic/include-classic.js"></script>
<script type="text/javascript">
    var map, layer,
        host = window.isLocal ? window.server : "https://iserver.supermap.io",
        url = host + "/iserver/services/map-world/rest/maps/World";
    //初始化地图
    map = new SuperMap.Map("map", {
        controls: [
            new SuperMap.Control.Navigation(),
            new SuperMap.Control.Zoom()]
    });
    map.addControl(new SuperMap.Control.MousePosition());
    //初始化图层
    layer = new SuperMap.Layer.TiledDynamicRESTLayer("World", url, null, {maxResolution: "auto"});
    //监听图层信息加载完成事件
    layer.events.on({"layerInitialized": addLayer});
    function addLayer() {
        map.addLayer(layer);
        //显示地图范围
        map.setCenter(new SuperMap.LonLat(0, 0), 0);
    }
    
    baiduLayer = new SuperMap.Layer.Baidu();

    map.addLayers([baiduLayer]);
</script>
</body>
</html>

是将两个图层都叠加了,但是因为都是全球地图,所以只能看到后添加的baiduLayer,您可以切换下两个addLayer方法的执行顺序,来验证。

420EXP 2022年10月28日

我图层是叠加上去了,但是我的图层是局部地区的,不在正确的位置上!该如何做操作呢?

这块儿看您的数据似乎在(0,0)附近,是否可以提供下测试数据和demo?

yanyixiao@supermap.com
...