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(
        'Map',
        'https://photos-6.dropbox.com/t/0/AAAV8wq9f9veyq0ffFO_8q-U7RI3trvDjaRNp3TFHf6ROg/12/7556067/png/2048x1536/3/1364878800/0/2/map.png/1Rw0Hlsla1l7-28tvi518yhNaoNNBBvNPop_WiSCOJI',
        new OpenLayers.Bounds(0, 0, 770, 399),
        new OpenLayers.Size(1540, 1481),
        {
            numZoomLevels: 2,
        }
    );

    map.addLayers([graphic]);

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

http://jsfiddle.net/grabus/wpDSU/

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

 
discard

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

Browse other questions tagged or ask your own question.