calvinmetcalf / leaflet.shapefile

Shapefile in Leaflet
http://calvinmetcalf.github.io/leaflet.shapefile/
MIT License
259 stars 119 forks source link

fix mistake when use ArrayBuffer #65

Open DistChen opened 3 years ago

calvinmetcalf commented 3 years ago

we probably want to keep the old misspelled version to so have it check for both i think

DistChen commented 3 years ago

we probably want to keep the old misspelled version to so have it check for both i think

yes, you are right!

I have another idea. Is it possible to modify like this in order to delete this config in options ?

var promise;
if (file instanceof ArrayBuffer) {
      promise = this.worker.data(file, [file]);
} else {
     promise = this.worker.data(cw.makeUrl(file));
}

initialize method :

if (!(file instanceof ArrayBuffer)) {
    this.worker = cw(new Function('data', 'cb', 'importScripts("' + this.options.importUrl + '");shp(data).then(cb);'));
} else {
    this.worker = cw(new Function('data', 'importScripts("' + this.options.importUrl + '"); return shp.parseZip(data);'));
}