0

I have a JPEG file with an associated .JGW worldfile containing the following data:

0.0144218
0
0
-0.0144218
-65758.8265181
-130841.5565499

My Jpeg is 21177*14242 pixels resolution.

I'm currently working with the following code:

let extent = [0, 0, 0, 0,]; //I need the correct values!

let exampleProjection = new ol.proj.Projection({
code: 'orto-image',
units: 'pixels',
extent: extent //I need the correct values!
});

let exampleImageSource = new ol.source.ImageStatic({
url: "https://mywebsite.com/uploads/example.jpg",
projection: exampleProjection,
imageExtent: extent //I need the correct values!
});

let exampleImageLayer = new ol.layer.Image({
source: exampleImageSource 
});

I would like to present this image over my OSM map. How can this be achieved?

1

Those values would give

left = -65758.8265181
top = -130841.5565499
right = -65758.8265181 + 0.0144218*21177 = -65453.4160595
bottom = -130841.5565499 - 0.0144218*14242 = -131046.9518255

extent = [-65758.8265181, -131046.9518255, -65453.4160595, -130841.5565499]

I don't know what projection that would be in, or if OpenLayers and/or the browser could handle a 300 megapixel image.

  • Thank you Mike I will try this tomorrow and write down the formula if it works. – Steffan Clent Davies Feb 20 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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