首页 / 浏览问题 / 云GIS / 问题详情
OpenLayer报错ol未定义
4EXP 2019年07月17日

使用产品:iclient-openlayer 9d  操作系统:win8 x64
数据类型:文件型
问题详细描述:无法加载地图,编译器显示:Uncaught ReferenceError: ol is not defined

代码:

url = "http://localhost:8090/iserver/services/map-ugcv5-mapunclear/rest/maps/map_unclear";
        map = new ol.Map({
            target: 'map',
            controls: ol.control.defaults({attributionOptions: {collapsed: false}})
                .extend([new ol.supermap.control.Logo()]),
            view: new ol.View({
                center: [103.71,30.38],
                zoom: 3,
                projection: 'EPSG:4326'
            })
        });
        layer = new ol.layer.Tile({
        source: new ol.source.TileSuperMapRest({
            url: url
        }),
        projection: 'EPSG:4326'
        });
        map.addLayer(layer);

1个回答

你好,看样子是库没引入。如果你是CDN 在线引入的方式的话请完全按照http://iclient.supermap.io/web/introduction/openlayersDevelop.html开发指南的方式引

3,352EXP 2019年07月18日
...