Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getBoundingBox latitude off? #32

Open
bsuwal opened this issue Jul 26, 2017 · 2 comments
Open

getBoundingBox latitude off? #32

bsuwal opened this issue Jul 26, 2017 · 2 comments

Comments

@bsuwal
Copy link

bsuwal commented Jul 26, 2017

I was computing the midpoint of my image from the getBoundingBox() and noticed the latitude was always a bit north of my actual image. This may be only specific to my images, but it seems that this is what caused it:

the getOrigin() function gets me the top left (north-west) coordinate of the image. The line
var y2 = y1 + resolution[1] * this.getHeight();
would then always be north of the already north-most coordinate. This is what worked for me: changing the + sign in that code snippet to a negative sign
var y2 = y1 - resolution[1] * this.getHeight();
This is would mean that y2 is now the southern border of the image. This code is from the getBoundingBox() function

@matthesrieke
Copy link

I second this. I am using GeoTIFFs of geostationary satellites, and I had to adjust the bounding box with the origin myself in order to display it correctly with openlayers.

Here is what I did, its a workaround and imho needs a fix in the getBoundingBox() function.

const gt = geotiff.parse(...);

// for debugging, just use the first
const i = gt.getImage(0);
const origin = i.getOrigin();
const bbox =  i.getBoundingBox();

// manually fix miny and maxy
const targetBbox = [bbox[0], bbox[1] - origin[1] * 2, bbox[2], bbox[3] - origin[1] * 2];

@constantinius
Copy link
Member

Hi @matthesrieke and @bsuwal!

Thank you for submitting this issue!
Could you please provide an example image where this happens?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants