danzel / Leaflet.utfgrid

A UTFGrid implementation for leaflet that is super small.
MIT License
132 stars 51 forks source link

Implementing setUrl() #29

Closed prebm closed 9 years ago

prebm commented 9 years ago

Extending L.TileLayer instead of L.Class to obtain setUrl() functionallity

danzel commented 9 years ago

Should we be going for L.GridLayer from leaflet (next version) instead?

prebm commented 9 years ago

As I understand it UTFGrids are kind of a grid layer, so I guess they would fit as subclass of L.GridLayer. Some of the inherited functions do not work at the moment - a fact I forgot in yesterdays testing. Would you need to rewrite the whole plugin to make everything work correctly?

danzel commented 9 years ago

Perhaps... Tell me more about setUrl, does it let you change the URL of the utfgrid tiles?

prebm commented 9 years ago

The setUrl function let you change the URL of the utfgrid tiles and redraws the utfgrid tiles from the new URL.

In fact, with the new redraw function, the setUrl() can just be copied from L.TileLayer and added to Leaflet.utfgrid:

setUrl: function (url, noRedraw) {
    this._url = url;

    if (!noRedraw) {
        this.redraw();
    }

    return this;
},

This is working with Leaflet 0.7.3 but not with Leaflet 0.8. The version from my pull request is working with both versions.

prebm commented 9 years ago

Closing because of new pull request #33