jywarren / plots-leaflet-viewer

A leaflet-based TMS viewer which accepts a TMS URL as a GET parameter. Good for fullscreen map viewing and embedding.
http://archive.publiclaboratory.org/leaflet/?tms=http://mapknitter.org/tms/lone-rock-pond/&lon=-73.0733&lat=43.96055&zoom=18
4 stars 0 forks source link

Need loading Indicator for larger datasets #6

Open nickrsan opened 12 years ago

nickrsan commented 12 years ago

Migrating issue from MapKnitter issues (https://github.com/jywarren/mapknitter/issues/123#issuecomment-8408524):

I have, a number of times, gone to load up maps in the web viewer, and given up because I thought it was a bug. The browser (Firefox and Chrome Latest, Win 7 Home and Pro x64) never shows a loading indicator, nor does the map, so it always looked complete...but with no image except the basemap. Today, I left it open while coming to submit a bug about image loading (knowing it must be localized to me if it wasn't already reported), and when I switched back, I discovered that it had loaded, just after a long time (I'm still on DSL).

A loading indicator will go a long way toward this. I just cloned a copy, so maybe as my first foray into the code, I'll see if I can patch one in. Don't count on it yet though. I see that it's a third party viewer, so this might be a bit much for my limited time right now.


So, after jywarren's suggestion to move it here, I did a quick look in the leaflet docs. I don't see anything to simply enable a loading indicator (shucks), but I do see two events that would enable one to be built in: http://leaflet.cloudmade.com/reference.html#map-options

loading Event Fired when the tile layer starts loading tiles. load Event Fired when the tile layer loaded all visible tiles.

I have not yet looked into whether or not these events were added pre plots fork or not, but I'm going to leave this here for now, and come back to it later.

nickrsan commented 12 years ago

So, I actually started working on this a bit. I have a snazzy loading indicator and a bit of loading code based on the MapKnitter logo, but have two things I need or that are stalling it a bit:

1) Just to confirm, all of the knitted images come out as tiles, correct, not as georeferenced rasters? The loading/load events for leaflet only fire for Tiles. 2) I'm needing an idea for an actual progress indicator, but I don't think we'll get one. For the datasets that take longer to load, it's possible that people will start to not believe a loading animation. I think we can get away with it by asking the browser to preload the tiles as part of the page, but that would be a huge workaround for something small. I'll probably leave this out for now and if we can find a good way to do it, modify the loading indicator then.

jywarren commented 12 years ago

yes, they're TMS style tiles. Just a spinner should work, no? like: http://spectralworkbench.org/images/spinner-small.gif or bigger?

Awesome, this is exciting. Where are you adding the code? if it's easy enough to package, we could submit upstream changes to Leaflet, maybe.

nickrsan commented 12 years ago

Right now it's all local and I was going to submit a patch (though I haven't done that before with Git - I tend to use Hg - so we'll see). If it's easier, I can make a fork to merge back in.

A spinner would absolutely work and would very probably be better. I'll show you what I made (mostly because it's a bit of fun with the logo) in case you want it for anything else, but it absolutely doesn't need to be used.

jywarren commented 12 years ago

cool -- well i'll accept a patch or a pull request, no problem. I think pull requests are nominally easier because Github has a nice one-click "accept pull request" thing. But either way. Awesome.

On Wed, Sep 12, 2012 at 3:46 PM, Nick notifications@github.com wrote:

Right now it's all local and I was going to submit a patch (though I haven't done that before with Git - I tend to use Hg - so we'll see). If it's easier, I can make a fork to merge back in.

A spinner would absolutely work and would very probably be better. I'll show you what I made (mostly because it's a bit of fun with the logo) in case you want it for anything else, but it absolutely doesn't need to be used.

— Reply to this email directly or view it on GitHubhttps://github.com/jywarren/plots-leaflet-viewer/issues/6#issuecomment-8507403.