I recently updated my work's app to OL 3.3 from OL 3.0. I had a few basemap layers that looked like this:

    "basemap1": new ol.layer.Tile({
                extent: new ol.proj.transformExtent([-180.0,-90.0,180.0,90.0], "EPSG:4326", "EPSG:3857"),
                source: new ol.source.XYZ({
                        tileUrlFunction: function(coordinate) {
                        if(coordinate == null){
                                return "";
                        var z = coordinate[0];
                        var x = coordinate[1];
                        var y = (1 << z) - coordinate[2] - 1;
                        return 'http://tileurl.com/'+z+'/'+x+'/'+y+'.png';
                visible: true

Which worked just fine in OpenLayers 3.0, but for some reason aren't appearing in OL 3.3.


The solution to the problem ended up being the extent:

    extent: new ol.proj.transformExtent([-180.0,-90.0,180.0,90.0], "EPSG:4326", "EPSG:3857"),

Once this line was commented out, the basemap appeared as normal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.