Last active
December 31, 2015 12:49
-
-
Save js1568/7989256 to your computer and use it in GitHub Desktop.
Extend L.GeoJson to allow changes to the Feature Group after creation. Useful for dynamic filtering and map layer event processing.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
L.GeoJSON.include({ | |
setOptions: function(opts) { | |
//save original json data | |
this._data = this._data || this.toGeoJSON(); | |
//destory layer group | |
this.clearLayers(); | |
L.setOptions(this, opts); | |
//recreate layer group | |
this.addData(this._data); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage example: