rl-institut / NESP2

Webmap (using leaflet) for visualizing village cluster identification and prioritization for off-grid electrification in Nigeria.
GNU Affero General Public License v3.0
2 stars 2 forks source link

Some tiles take a long time to load #91

Open Bachibouzouk opened 4 years ago

Bachibouzouk commented 4 years ago

I think this is why the heroku app fail to load some tiles

christian-rli commented 4 years ago

It fails to load some tiles, because they are out of bound for that specific layer. For example the medium voltage grid only covers the area of Nigeria, but the map tries to access tiles outside of that area, so loading of these tiles fails. For some reason though heroku interprets the layering (of the background and presumably the other layers as well) differently. I can see that the national view tiles are loaded (in fact faster than the hot tiles), but are then covered by the hot tiles. This does not happen to me locally. The function after this line:

https://github.com/rl-institut/NESP2/blob/5ce225debfcb45f3d004e7a01b2a68bacfd7cbe8/app/static/js/map.js#L213

arranges layers (for me) in the correct order.

Bachibouzouk commented 4 years ago

Maybe some hints there : https://leafletjs.com/plugins.html#tile-load

Bachibouzouk commented 4 years ago

Or instead of removing and adding the layer, we could use setOpacity and reorder them? https://leafletjs.com/plugins.html#layer-switching-controls

christian-rli commented 4 years ago

The "trick" I'm using for the transition of national level to state level is to have osm_gray already as a background layer, but not visible because it's covered by the custom gray elevation layer. When transitioning to state level the top layers are just removed. I'm not sure if this is the best approach, because it leads to quite a bit of traffic, maybe even slowing down everything altogether.