2
Driver: GTiff/GeoTIFF
Files: correctly_merged.tif
Size is 44835, 26402
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (13.159040050633186,11.913294314323917)
Pixel Size = (0.000003210050390,-0.000003210074723)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (  13.1590401,  11.9132943) ( 13d 9'32.54"E, 11d54'47.86"N)
Lower Left  (  13.1590401,  11.8285419) ( 13d 9'32.54"E, 11d49'42.75"N)
Upper Right (  13.3029627,  11.9132943) ( 13d18'10.67"E, 11d54'47.86"N)
Lower Right (  13.3029627,  11.8285419) ( 13d18'10.67"E, 11d49'42.75"N)
Center      (  13.2310014,  11.8709181) ( 13d13'51.60"E, 11d52'15.31"N)
Band 1 Block=44835x1 Type=Byte, ColorInterp=Red
Band 2 Block=44835x1 Type=Byte, ColorInterp=Green
Band 3 Block=44835x1 Type=Byte, ColorInterp=Blue

I found this answer in JAVA but I cannot understand it. Anyone who can tell me in python?

Convert latitude longitude pair to pixels in geotiff

2

1 Answer 1

2

You certainly can. I like to use geoio for this kind of stuff.

import geoio
filename = ... # filename of the image
img = geoio.GeoImage(filename)
xPixel, yPixel = img.proj_to_raster(lon, lat)

Will do it. You can also go in the other direction with their raster_to_proj method.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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