Leaflet.FileLayer icon indicating copy to clipboard operation
Leaflet.FileLayer copied to clipboard

File size limit

Open 1stgongsin opened this issue 6 years ago • 6 comments
trafficstars

Input file size limit is now 1024kb In the leaflet.filelayer.js file, I change this value(1024) to 9999, but limit didn't change. Is it impossible to change upper limit of gpx(kml) file size?

1stgongsin avatar Feb 25 '19 08:02 1stgongsin

I don't remember the history of this option... but fileSizeLimit is defined twice in the source file, so maybe you forgot once. And a priori it's an option, so shouldn't have to modify the lib file.

leplatrem avatar Feb 25 '19 09:02 leplatrem

Thank for reply, leplatrem. Over 1Mbytes gpx or kml file does not appear on the map. i think togeojson.js can't process over 1Mbytes size of gpx or kml.

1stgongsin avatar Feb 25 '19 13:02 1stgongsin

i think togeojson.js can't process over 1Mbytes size of gpx or kml.

I doubt it.

Any error in the browser console?

leplatrem avatar Feb 25 '19 18:02 leplatrem

but fileSizeLimit is defined twice in the source file,

The second is excessive (IMHO better remove it from FileLayerLoad defaults).

In the leaflet.filelayer.js file, I change this value(1024) to 9999

You should not change source, as the value can be specified in options.

var control = L.Control.fileLayerLoad({ fileSizeLimit: 2048 })

And it works, I've just checked it myself.

johnd0e avatar Mar 29 '19 09:03 johnd0e

Great plugin. Had a couple of problems initially. Tried out the demo and a lot of my files didn't show. Started to wonder if the plugin was any good. Had a look in the console - no error messages.

Turns out a lot of my gpx files were over 1024 kb. After messing around, the documentation gave the much needed clue.

Would like to see:

  1. The default 1024 kb raised to 2048 kb. I can load 20 files greater than 1mb each and have no problems. There is no max file count so you could still exceed some practical limit. May be a max data amount is needed rather than the 1024kb limit per file. ie load all files and stop loading when the file(s) total amount exceeds say 50mb?
  2. An option that writes anything that goes to data:error (error) to the console. Default to enabled. User can then choose to turn console logging off. That would immediately show why larger files are not processed. Would have saved me a lot of time.

Thanks once again for the effort.

a-lurker avatar Jul 07 '19 00:07 a-lurker

Please, don't hesitate to open pull-requests!

leplatrem avatar Jul 29 '19 11:07 leplatrem