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.

Within OpenLayers, I have two images, both jpg with world files, and each 1440 x 900 px. The two images are geographically located next to each other. Is there a way to display both images at the same time. I can make an image layer for each and use the Layer Selector to toggle between them, but I cannot figure out how to display both images together.

From my reading it appears that an image layer is a base layer, and since two base layers cannot be active at the same time, I can only have one or the other active.

thanks

share|improve this question
add comment

2 Answers

An image layer is a layer pointing to an image at some URL. You can specify if you can they act as base layer with the "isBaseLayer" property. simply set it to false to act as overlay.

Here is a sample using image layer (http://openlayers.org/dev/examples/image-layer.html):

        var graphic = new OpenLayers.Layer.Image(
            'City Lights',
            'http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif',
            new OpenLayers.Bounds(-180, -88.759, 180, 88.759),
            new OpenLayers.Size(580, 288),
            options
        );

If you want the image were visible always (at any level or without specifying levels) set the 'alwaysInRange' (inherit from base Layer class) to true.

share|improve this answer
add comment

If you want/need/have to have it as a base layer - why not combine the 2 images into 1 (say with Paint.net) and then you have just 1 image in 1 base layer?

Other option would be to have 2 non-base layers that are always on and you can have the 2 images next to each other that way. You can even have a blank base map, that way there's nothing else on the map except your 2 images. And as you add more layers, your 2 non-base layers, basically become 'base layers' because they'll be at the bottom of the stack.

share|improve this answer
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.