How show legend(s) only for toggled layers on map? - javascript

I create map using Mapox with 7 layers thanks to this example. This layers I can switch on and switch off on the map thanks to buttons for each layers.
At the same time I don't have any spetial knowledge in Javascript. It's restrict me to create legends (div element) for each layers. The particular legend(s) must show on the fly when particular layer(s) switched on.
I found function L.mapbox.legendControl. But how it applies for my purpose?
Where and which code have to use for make legend like pictured here

Related

How to add leaflet map layers (overlay and basemap) as a scrollable/selectable html elements?

Current Setup
I am new to leaflet js area (and have only beginner level of understanding of html, css & js). I am trying to add the map layers (both overlay and basemap layers) as html elements with same functionality as overlay maps plugin, so that it looks like below, and on selection to display the information below the layers section as shown
Requirement
and upon selection showing user the classification/styling applied on the map
Showing user classification/styling upon selection
This is a simplified version of what i am working on
Sample Code
It is possible that this question was asked before as much as i looked i couldn't find it.
Thanks in advance for any help

Openlayers : Prevent features icons overlay

I'm using openlayers (v6.4.3) to display a map with features in different layers. I want to prevent overlay of feature's icons from different layers : if two of them overlap, I have to move one of the icons. I looked on the official openlayer's documentation but I can't find an option or a method to achieve that.
Thanks for any help !

Add multiple tilesets of same area to same style in mapbox

I am working on a project to show variation in NDVI values of a district in India on a fortnightly basis on Mapbox. For that I need to overlay a layer of tileset showing NDVI values of that district upon a map of India. The problem is that I have to do it for a couple of tilesets (Around 50) of the same district. One way is to use different styles for different tilesets. But it is limited to 20 styles for a free account. Other way is to use same style and overlay the different layers of 'NDVI maps' one upon other. But in that case I'm only able to see the topmost layer. Rest of the layers of same district are not visible. I see that there are two possible solutions.
Find a method to put/show a particular layer on top at a time. Rest of the layers would be below the current layer, hence would not be visible.
Find a method to automate the addition of a tileset to a style and reset the style (means delete or hide the previous added layer) and add a new layer and show it.
Please help. If the question is not clear, please inform.

Google maps styling query

I've played around with the FusionTablesLayer Wizard (http://gmaps-samples.googlecode.com/svn/trunk/fusiontables/fusiontableslayer_builder.html) to create a map of wind turbines in North Devon.
http://www.thisisnorthdevon.co.uk/images/localpeople/ugc-images/275834/binaries/WindTurbines.html
But there are two problems.
The first is that the styling that I'd created within the Fusion Table layers has not carried through. Is there a switch to force the layer to take on this styling?
The second is that I don't want the shapefile layer to be clickable. How do I turn this off?
But there are two problems.
The first is that the styling that I'd created within the Fusion Table layers has not
carried through. Is there a switch to force the layer to take on this styling?
Not sure what styling you are asking about. Is it styling defined in the FusionTable? By the FusionTables Wizard? It looks like you may be missing the application of the styles to the map this or the equivalent:
map.setOptions({styles: styles});
You might want to review the documentation on styling the map
The second is that I don't want the shapefile layer to be clickable. How do I turn this off?
To disable clicks on that FusionTablesLayer, use the suppressInfoWindows option when you construct it.
your page with infowindows suppressed on the polygon layer and styling, note that your html is invalid (no body).

Grouping layers with groext - openlayer overlays menu

i can't find out how to grup layers like in this example
http://dev.openlayers.org/releases/OpenLayers-2.10/examples/controls.html
press the upper + button
as you can see there's a checkbox and two radio buttons
anyone knows a way to group layers so that they are displayed under the same group and it's possible to choose only one among them? (radio button)
thank you
You can try using GeoExt tree to do this, like this:
http://api.geoext.org/1.0/examples/tree.html
At this time OpenLayers does not support grouping beyond those mentioned by Brian above.
What are you trying to display on the layers? Vectors can be combined with styleMap. You might want to try is to make your layers base layers instead of overlays.
In OpenLayers there are 2 types of layers: base layers and overlays. When you add more than one of either of these to a map you get slightly different behaviour.
Base layers can only be displayed one at a time and a radio box is displayed to select which one is displayed. Check boxes are displayed for Overlays because any number of overlays can be displayed on top of a base layer. More information and examples are available on the wiki.
You

Categories