Bounding overlay image to lat/lon coordinates, preferably with a World File
in
Programming Questions
•
4 months ago
Hello again! I'm using a US Map via Unfolding, and overlaying a PImage onto it that represents a weather radar image.
Radar Image:
http://mesonet.agron.iastate.edu/archive/data/2013/05/31/GIS/ridge/ICT/N0Q/ICT_N0Q_201305312339.png
The "World File" that defines it's bounds is here:
http://mesonet.agron.iastate.edu/archive/data/2013/05/31/GIS/ridge/ICT/N0Q/ICT_N0Q_201305312339.wld
Here is the code I'm using. I need some help in translating the World File into a value I can use for 's' for scaling, or another method of doing so. I know the center coordinates and the upper left coordinates.
Code snippets of what I have:
PGraphics pg;
PImage img = loadImage("http://mesonet.agron.iastate.edu/archive/data/2013/05/31/GIS/ridge/ICT/N0Q/ICT_N0Q_201305312339.png")';
pg.pushMatrix();
pg.translate(x,y); // x and y represent the center of the image in pixels (400x400px in my case)
pg.scale(s);
pg.image(img, -(img.width/2), -(img.height/2)); // Set to center of image. Image is 1000x1000 px
pg.popMatrix();
Thanks!
Radar Image:
http://mesonet.agron.iastate.edu/archive/data/2013/05/31/GIS/ridge/ICT/N0Q/ICT_N0Q_201305312339.png
The "World File" that defines it's bounds is here:
http://mesonet.agron.iastate.edu/archive/data/2013/05/31/GIS/ridge/ICT/N0Q/ICT_N0Q_201305312339.wld
0.010483 (X pixel size in lon units per pixel)The center location of the PImage is correct in my code, which is over Wichita, Kansas (37.6922,-97.3372). but I don't know how to scale it for the correct size in relation to the US Map. The radar image appears to be about 10 degrees tall and wide, which roughly fits with pixel size * image size (1000x1000 px).
0.0 (rotation)
0.0 (rotation)
-0.010483 (Y pixel size in lat units per pixel)
-102.684387 (Longitude upper left corner)
42.895387 (Latitude upper left corner)
Here is the code I'm using. I need some help in translating the World File into a value I can use for 's' for scaling, or another method of doing so. I know the center coordinates and the upper left coordinates.
Code snippets of what I have:
PGraphics pg;
PImage img = loadImage("http://mesonet.agron.iastate.edu/archive/data/2013/05/31/GIS/ridge/ICT/N0Q/ICT_N0Q_201305312339.png")';
pg.pushMatrix();
pg.translate(x,y); // x and y represent the center of the image in pixels (400x400px in my case)
pg.scale(s);
pg.image(img, -(img.width/2), -(img.height/2)); // Set to center of image. Image is 1000x1000 px
pg.popMatrix();
Thanks!
1