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
Related
I have an issue with one thing.
I have a map of world and I want to add functionality when a user clicks on one of the list elements (you can see 3 lists with different places on the image, for example, Paris Air Show) it would show me on the map. As you can see on image example
Is it possible to do? It should work on different devices, but I have no idea how to create that.
Thanks a lot for your help.
Here is a good solution, which works for me.
So I've created a map with areas and on those areas, I put coordinates of places and this map is attached to the image. Then I calculate a place using map.getBoundingClientRect()
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
Is there an easy way to make a leaflet layers control (L.control.layers) use checkboxes rather than radio buttons?
I have multiple WMS tile layers, and I'd like to be able to have more than one on the map at the same time. For context, the WMS tile layers include bathymetry and contours (topo lines), so it'd be more informative to visualize both at the same time, rather than just having some lines floating in the ocean.
In the leaflet example it says the layers control is "smart enough" to know which to assign radio buttons and which checkboxes, but it'd be nice to have more customized control.
Relevant code:
L.control.layers(WMS, null, {collapsed: false}).addTo(map);
where WMS is multiple L.tileLayer.wms layers.
Pass your WMS as the 2nd argument (i.e. as overlays) instead of the 1st (basemaps) of L.control.layers.
Overlays use check boxes, whereas basemaps use radio buttons.
Here i create an example to demonstrate what ghybs said.
L.control.layers(null, mixed).addTo(map);
Checkout my jsfiddle http://jsfiddle.net/iofirag/Ltub5bgv/18/.
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.
How can I display a digit inside the GMarker ?
I used title, but it is only on rollover like title on links or image.
Do you have any idea how I can do that ?
There's two ways to do it.
The old way is to create or obtain images for markers with each number and use them as custom icon images. There are several sets listed here or you can use one of the services listed there to create your own, or draw your own with an image editor. Save the resulting images to your own webspace, don't try to use the services dynamically because they occasionally fail.
The new way is to use the LabeledMarker extension which creates things that work something like Google markers but allow you to put text onto the marker dynamically. (Hint: works quite nicely with MapIconMaker, like this.)
You can create custom markers with mapicon Factory. Select the Characters radio button and pick a character type, and then click the Numbers checkbox. Dismiss the ad and you will see the markers.