Do not free tiles on layer hide - leaflet

I'm using Leaflet's layer control to show / hide two different tile layers. Users toggle layers on and off to observe changes between them. The problem is that when a layer is hidden and reshown, all of the tiles are being fetched again. I want the layer to be hidden such that showing it again should be instantaneous as the tiles have already been loaded (unless the user has panned / zoomed). I've gone through the documentation and can't find an option that controls this.
Perhaps the layer control is totally deleting and recreating layers as they are unchecked / checked again?
This is on Chrome under Windows. It is noted that Mobile Safari on iOS does not reload the tiles when a layer is reshown.

Related

ArcGIS online reordering popups

I’m using the new map viewer and I have two overlapping polygon layers. When I have popups turned on for both layers, but I’d prefer popups for one layer shows up first.
Is there a way to reorder popups without reordering layers?
There's no way to make these pop up reordered. I hope esri fixes this soon- it is obnoxious!

Is it possible in chrome devtools to lock some layer of DOM that won't be selectable when inspecting DOM without removing or hiding it?

In many drawing software/app, you can lock a layer so it's not annoying when you try to use your mouse to pick some element/shape inside it.
However, I'm encountering the same problem with my chrome devtools. Especially when dealing with SVG shapes.
For instance, I want to lock this huge layer .green_background so it won't affecting me inspecting my small rects inside the graph.
Is it possible for ChromeDevTools?

With Leaflet markercluster, how can I switch between clustered and unclustered without changing zoom level?

I am using the Leaflet.markercluster plugin to cluster my points.
However, users are asking for the functionality to switch between clustered and unclustered views (basically, they want to see all their points at a high zoom).
I know that I can disable clustering at a specific zoom level:
markers = new L.MarkerClusterGroup({
disableClusteringAtZoom: 8,
})
How can I force everything to uncluster when I am further zoomed out, though?
You would probably be interested in Leaflet.MarkerCluster.Freezable plugin.
It provides extra methods on Leaflet.markercluster, including disableClustering() and enableClustering(), which enable you to uncluster / cluster programmatically (e.g. on a button click) without needing the user to zoom in/out.
See also the plugin demo page.
Of course, you should be careful whenever you call disableClustering(), since you may instantly load all your markers on map (if you are zoomed out to their full extent). If that tries loading thousands of markers, you may freeze your browser or even crash it.
Disclaimer: I am the author of this plugin.

Virtual Earth Shape Rendering Performance

I am overlaying a transparent image on my VEMap control by rendering it as a single VEShape. The shape changes sizes dynamically depeding on the zoom level of my map and can be as large as 4000*4000px. In older browsers such as IE6 and early versions of Firefox 2.x, map control performance degrades rapidly when my shape gets larger than 1500*1500px. The mouse pointer moves slowly and the map responds very slowly to events. I don't see this issue at all in newer browsers (IE7+).
Are there any workarounds to boost performance of rendering a large shape for IE6 users?
The solution you're probably looking for is to actually use "Map Cruncher" to create map tile images from your image. Then these map tile images can be overlaid on the VEMap using a Custom Tile Layer, and will be rendered exactly the same way as the Map Images themselves.
http://www.microsoft.com/maps/product/mapcruncher.aspx

iPhone layer management - best practice

Louis - Thanks for your input. Here is what I did, and my current issues, which i don't understand.
The menus (2) are UIImageViews that respond to touch. Each is it's own class. The 'sprites' as you called them also respond to touch.
In the .m where I add the menus and sprites to the layer, I created two container layers, via this code: menuContainer = [CALayer layer].
I ordered them with the menuContainer above the spriteContainer. Now, the sprites do move below the menus - great! But in the process, the sprites stopped responding to touch (I can understand this as they are below the menuContainer layer), and the menus stopped responding to touch as well (don't get that). Continuing to confuse the situation, a layer added to the menuContainer that responds to a multitouch gesture by popping up a slider still reads the multitouch and pops up the slider, but I can't slide the slider. This has me thoroughly confounded.
Thanks.
My app is building a background layer, then building some menu layers that should always be at the top.
After this, I add many moving layers and remove many moving layers very quickly.
My problem is I want my menu layers (there are 4) to always be in front of the other layers. I have thought of building a layer hiearchy and using the insertsublayer: atindex: method, making my menus a notional index of 1000, and inserting the multitude of moving layers at a lower index, like 200. If I insert one layer at 200 and then the next at 200, does the first layer that was assigned to 200 get shifted (to 201) or does it get blown away?
I have tried inserting the layers with the insertsublayer: below:, but that does not give me the desired results.
Thanks for the help.
You can't really do that, the layer index is not a z-order, it is an array index. From the documentation:
This value must not be
greater than the count of elements in
the sublayer array.
I think you would be best served but actually making a true hierarchy of layers as opposed to trying to shove all of you active layers into one super layer. In other, but all of your menulayers into a container layer, then insert that in the root layer where you want it. Likewise, insert all your sprites into one container layer, and put that in the root layer where you want it.
Additional stuff based on your edits:
Layers are a essentially a graphical construct, they do not directly respond to events. You either need to handle that yourself by writing code to hitTest them in the view they are attached to, or you need to use UIViews instead of layers. You were probably getting away with it before because you were manipulating the layers in such a way that the view hierarchy and layer hierarchy were consistent, but it was not clear to me from your original question that you were using views and not a purely layer based setup.
Louis -
Thanks for your input. Here is what I did, and my current issues, which i don't understand.
The menus (2) are UIImageViews that respond to touch. Each is it's own class.
The 'sprites' as you called them also respond to touch.
In the .m where I add the menus and sprites to the layer, I created two container layers, via this code: menuContainer = [CALayer layer].
I ordered them with the menuContainer above the spriteContainer. Now, the sprites do move below the menus - great! But in the process, the sprites stopped responding to touch (I can understand this as they are below the menuContainer layer), and the menus stopped responding to touch as well (don't get that). Continuing to confuse the situation, a layer added to the menuContainer that responds to a multitouch gesture by popping up a slider still reads the multitouch and pops up the slider, but I can't slide the slider. This has me thoroughly confounded.
Thanks.