ghybs / Leaflet.TileLayer.Fallback

Replaces missing Tiles by scaled lower zoom Tiles
Apache License 2.0
36 stars 18 forks source link

Missed tile replace not work #8

Closed CosmaVito closed 6 years ago

CosmaVito commented 6 years ago

Hi,

i have a map in my web app (an angular 2 web app). I have installed Leaflet 1.0.1 and then the latest version of Leaflet.TileLayer.Fallback

I want to replace the missed tile with a static tile placed in a Content directory (the name of thi tile is no-tile.png).

I set bounds for my map. But i think that is not related to this.

var openstreetmapLayer = new L.tileLayer.fallback("/Content/openstreetmap/{z}/{x}/{y}.png", {errorTileUrl: '/Content/no-tile.png' });

 let bounds = new L.LatLngBounds(new L.LatLng(38.83328935686689, 9.9700927734375), new L.LatLng(42.31184652369512, 8.000793457031264));
        this.map = new L.Map(this.el.nativeElement, {
            center: bounds.getCenter(),
            minZoom: 8,
            maxZoom: 18,
            zoomControl:true,
            layers: [
                openstreetmapLayer
            ],
            maxBounds: bounds,
            maxBoundsViscosity: 1.0
        });

        let latlngs = L.rectangle(bounds).getLatLngs();
        L.polyline(latlngs[0].concat(latlngs[0][0])).addTo(this.map);

But i have still this error

immagine

Thanks

ghybs commented 6 years ago

Hi,

If you could provide a Plunker or JSBin that reproduces your issue, that would tremendously help in understanding your situation.

Feel also free to ask for help on Stack Overflow.

ghybs commented 6 years ago

Most probably fixed by PR #10.

Please feel free to re-open with a reproduction example if you think it is a different issue.