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 tried create map with single image used OL.
But I have a trouble: image in map has a wrong proportions.

Img: 1540 x 1481
Img in map: 2858 x1481

My js code:

$(function (){
    var map = new OpenLayers.Map('map', {
        restrictedExtent : new OpenLayers.Bounds(0, 0, 770, 399),

    var graphic = new OpenLayers.Layer.Image(
        new OpenLayers.Bounds(0, 0, 770, 399),
        new OpenLayers.Size(1540, 1481),
            numZoomLevels: 2,


    map.setCenter(new OpenLayers.LonLat(lon=0,lat=0),0);


What I did wrong? Why img in map has wrong proportions? Tnx!

share|improve this question
It seems the image is rescaled to the proportions of the layer bounds. –  lynxlynxlynx Apr 2 '13 at 6:43
Yes, it is. But layer bounds should be 770x399. –  grabus Apr 2 '13 at 15:29
What is OL supposed to do, stretch the image? I haven't used it, but it sounds like you want to have a viewport of that size and are theregore using the wrong function. –  lynxlynxlynx Apr 2 '13 at 15:32

Your Answer


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

Browse other questions tagged or ask your own question.