首页 / 浏览问题 / 云GIS / 问题详情
iclient加载地图服务后显示infinity
216EXP 2019年04月16日

自己发布的地图服务为:

添加自己发布的地图代码为: 

//二维地图初始化
            map = new SuperMap.Map("mapContainer2D");
            // map.addControl(new SuperMap.Control.MousePosition());  //添加控件
            let control=new SuperMap.Control.MousePosition();
            map.addControl(control);

            //方式1,世界地图测试
            // var url1 = "http://support.supermap.com.cn:8090/iserver/services/map-world/rest/maps/World";
            // layer = new SuperMap.Layer.TiledDynamicRESTLayer("World", url1, {
            //     transparent: true,
            //     cacheEnabled: true
            // }, {maxResolution: "auto"});

            // 方式2,自己的地图
            // layer = new SuperMap.Layer.TiledDynamicRESTLayer("Map", URL_CONFIG.urlMap, {
            //     transparent: true,
            //     cacheEnabled: true
            // }, {maxResolution: "auto"}, {projection: "EPSG:2383"});

            //YJW 地图如果是白色的话,要设置图层透明transparent为true
            layer = new SuperMap.Layer.TiledDynamicRESTLayer("Map", URL_CONFIG.urlMap, {
                transparent: false,
                cacheEnabled: true
            }, {maxResolution: "auto"});

            layer.events.on({"layerInitialized": addLayer});
            layer.setOpacity(0.8);



function addLayer() {
            map.addLayers([layer]);
            //TODO:YJW 经纬度写死
            let lonLat = new SuperMap.LonLat(114.10,22.82);
            // map.setCenter(lonLat);
            // map.setCenter(lonLat, 16);
            map.setCenter(lonLat, 1);
            // map.setCenter(new SuperMap.LonLat(114.10, 22.82), 1);
            // this.map.setCenter(new SuperMap.LonLat(509340.59, 2523457.49), 0);

            if (layer != undefined) { //添加地图监听事件
                layer.events.on({"moveend": MaptoScene});
                //移除场景鼠标事件
                handler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
                handler.removeInputAction(Cesium.ScreenSpaceEventType.WHEEL);
            }

        };

iclient classic for JavaScript 9,加载地图服务后,MousePosition控件显示-infinity,-infinity。

1个回答

你好,你在iserver中可以浏览到地图吗?如果可以浏览到,你需要在前端用proj4来定义坐标
3,352EXP 2019年04月17日
...