We are developing an android application for showing an image with geo referened with .jgw and .prj file as below. we want to identify the geo location coordinate of image coordinate(in pixel) that user touched on the image. How we can use image cordinate to find ts relative latitude and longitude using java in android.
We tried proj4 java library for android but it seems incorrect when we find the distance of two point and we couldn't trace where is the issue.
Below are our .jgw and .prj file
JGW File
0.00000180562999999
0
0
-0.00000180562999999
76.882389 (dummy location due to NDA)
8.572607 (dummy location due to NDA)
PRJ File
GEOGCS["GCS_WGS_1984",DATUM["D_WGS84",SPHEROID["WGS84",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
Best Answer
You have world files (.jgw) and projection definition files (.prj).
World file values:
You can convert pixel coordinates to map coordinates (longitude, latitude assuming the projection is always WGS84 / EPSG 4326) using some simple maths:
Where mx, my = map coordinates and px, py = pixel coordinates.
In your case, as the rotation terms are zero, the equation becomes:
Which means x or y coordinate of top left corner + image coordinate * pixel size.