Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I would like to display a lot of images at same time. The images are georeferenced (they have extents), with some labels on top of it which, on click, open popup. I can not say how many exactly because it will depends of user choices.

And I want the user to choose the information he sees. There's some checkboxes he can check or not and it will display more or less images depending on his choices.

My problem is that I have to deal with the "issue" (which actually is not really an issue) described in OpenLayers wiki: What is the maximum amount of layers I can have in my OpenLayers Map?

I was wondering if there is a way to have more than 75 images. Because, the system actually works, except when I want to display more than 75 images: Popups and labels appear below images...

I tried a long time to play with z-index, without success though.

Thanks a lot.

share|improve this question
    
what's your back-end map server? It might allow you to render multiple layers as one image, which OpenLayers will then treat as one layer –  tomfumb Dec 17 '12 at 17:53
    
@tomfumb Geoserver. Maybe it is possible to do so with it, but I would like to hide some of the images when the user click on a checkbox, and if I have to load a new images each time the user click on one... Will be pretty long... (there's a lot of different checkbox, each hiding different images) –  Julien Fouilhé Dec 18 '12 at 9:30
    
You could create WMS service with Geoserver, that servers all images. Each image should be in separate layer (separate layer in WMS service, not separate layer in OpenLayers) and it should be turned off by default. In OpenLayers, create one WMS layer and control enabled layer by checboxes (layers=image1,image4,etc in request string). –  user1702401 Dec 18 '12 at 10:32
    
Ok so no way to do it with only OpenLayers? No way to change the z-index beginning or anything else? –  Julien Fouilhé Dec 18 '12 at 13:00
    
I'm sure you could do it with z-index, but in my experience of javascript web mapping APIs once you start trying to change how the API works you're heading down the wrong path. It might be worth going to the openlayers dev. mailing list and asking why this limit exists - perhaps some browsers start acting up beyond this number. If not they might give you a better idea of where to start. osgeo-org.1560.n6.nabble.com/OpenLayers-f3888594.html –  tomfumb Dec 18 '12 at 17:26
add comment

2 Answers

up vote 4 down vote accepted

Of course you can change the OpenLayers default z-index. Just overwrite the z-index default range before anything.

OpenLayers.Map.prototype.Z_INDEX_BASE.Feature = 2000;
OpenLayers.Map.prototype.Z_INDEX_BASE.Popup = 4000;
OpenLayers.Map.prototype.Z_INDEX_BASE.Control = 5000;
var map = new OpenLayers.Map();
...
share|improve this answer
    
Thank you, really! –  Julien Fouilhé Dec 29 '12 at 11:29
add comment

In theory, it should be possible to create one layer, add images as features with externalGraphic, and set their size (graphicWidth, graphicHeight) dynamically by context function. This will "emulate" georeferenced images.

In practice, first problem is - after changing zoom, when feature's origin is not on screen, it's not displayed. Zoom in in example, and you notice, that some tiles are missing. They will appear, when you pan around. Don't know, maybe there is workaround for this behaviour.

Here is example with four images: http://jsfiddle.net/nF7yQ/3/embedded/result/

share|improve this answer
    
I should have been more explicit, I want georeferenced images (with extents defined) because it shows data on a certain place of the map so I can't use features because the size doesn't change with the zoom, does it ? –  Julien Fouilhé Dec 17 '12 at 17:20
    
OK, in that case features with regular style aren't suitable. But it's possible to change style dynamically with context functions, so you can compute their size accordingly to resolution. I modified my original posting. –  user1702401 Dec 17 '12 at 22:42
    
With this solution, it would be really hard, because my images all have different extents and different sizes... So I imagine the necessary calculations and I'm scared :D –  Julien Fouilhé Dec 18 '12 at 10:42
    
Basically you don't need to do any calculations, you need just x1 y1 x2 y2 for each image. But, as said, that solution doesn't work correctly because of feature rendering issue. –  user1702401 Dec 18 '12 at 10:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.