首页 / 浏览问题 / 其他 / 问题详情
地图不加载为什么
22EXP 2017年06月13日
var map,layer,mapUrl,vector;
            mapUrl = "http://103.254.67.167:8090/iserver/services/map-QuanGuoShuJu2/rest/maps/全国数据";
            function init()
            {
                map = new SuperMap.Map("map",{projection: "EPSG:4326",controls:[
                    new SuperMap.Control.ScaleLine(),
                    new SuperMap.Control.Zoom(),
                    new SuperMap.Control.LayerSwitcher(),
                    new SuperMap.Control.Navigation({
                        dragPanOptions: {
                            enableKinetic: true
                        }
                    })
                ]});
                
                
                layer= new SuperMap.Layer.TiledDynamicRESTLayer("China100", mapUrl, {transparent: true, cacheEnabled:true},{projection: "EPSG:4326",maxResolution:"auto"});

                layer.events.on({"layerInitialized":addLayer});
                vector = new SuperMap.Layer.Vector("vector");

            }

            function addLayer()
            {
                map.addLayers([layer,vector]);
                //中心标记点
                map.setCenter(new SuperMap.LonLat(116.658086,40.128387),2);
            }

像这段代码, layer.events.on({"layerInitialized":addLayer});  这句话就是执行不对,为什么,写了这么多jsp文件,第一次遇到这个问题,该怎么解决

1个回答

未重现问题,建议检查代码逻辑及执行顺序。比如,jsp返回的html被浏览器执行的顺序。可以在JavaScript里加上debugger以在浏览器调试等。
1,780EXP 2017年06月14日
...