Carto DB的层正电子

Layer positron of Carto DB

我尝试添加由 Carto DB 使用 OpenStreetMap 数据制作的图层:'Positron'。

我有OpenLayers3,我在CartoDB网站的页面找到代码:http://cartodb.com/basemaps

因此,我将代码添加到 Javascript、

var cartodb_positron        = new ol.layer.Tile({source: new ol.source.XYZ({
                                    url: 'http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png',
                                    attributions:   [
                                        new ol.Attribution({ html: ['&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://cartodb.com/attributions">CartoDB</a>']})
                                                    ]
                                    })});

将图层添加到地图后

var map = 
    new ol.Map  ({
        target: 'map',
        layers: [cartodb_positron,vector_limit,vector_point],
        interactions: map_interactions,
        controls: map_controles,
        view: new ol.View({zoom: 11.20,minZoom: 11.20,maxZoom: 15, center: transform([1403000,2251475,1403000,2251475]),extent: transform([1380000,2211450, 1420157,2250936])})
                });

最后我的地图没有 mapbase,只有矢量图层...Mozilla firebug 说了什么。

感谢您的帮助。

我找到了回复!

不是

url: 'http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png'

但是

url: 'http://s.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png'