Help modifying geotiff information

Started by salleman, March 04, 2020, 10:36:46 AM

Previous topic - Next topic

salleman

I'm still not able to get what I need...

Is there a way to extract the projection information in ascii format, modify it to suit my needs, and re-inject it back into the tif file?

Also, can exiftool read projection information in from an ascii file created by listgeo?

salleman

And does this error message from geotifcp mean anything to you?

test> G:\alleman\SSS_Geotif\geotifcp.exe -g SC_03.md SC_03.tif SC_03_fixed.tif                                                                                           
SC_03.tif: Warning, wrong data type 7 for "GeoKeyDirectory"; tag ignored.                                                                       
SC_03.tif: Warning, wrong data type 7 for "GeoDoubleParams"; tag ignored.                                                                       
Failure in GTIFImport                                                                                       

Phil Harvey

Quote from: salleman on March 04, 2020, 01:45:12 PM
Is there a way to extract the projection information in ascii format, modify it to suit my needs, and re-inject it back into the tif file?

Yes.  Just read/write those tags normally. ie)

exiftool -pixelscale="0.0128746620000136 0.0120559770000436 1" -modeltiepoint="0 0 0 531697.611622669 4269956.09045799 0" FILE

QuoteAlso, can exiftool read projection information in from an ascii file created by listgeo?

Only if it is in a supported format (ie. json or xml)

Quote from: salleman on March 04, 2020, 01:48:27 PM
And does this error message from geotifcp mean anything to you?

test> G:\alleman\SSS_Geotif\geotifcp.exe -g SC_03.md SC_03.tif SC_03_fixed.tif                                                                                           
SC_03.tif: Warning, wrong data type 7 for "GeoKeyDirectory"; tag ignored.                                                                       
SC_03.tif: Warning, wrong data type 7 for "GeoDoubleParams"; tag ignored.                                                                       
Failure in GTIFImport                                                                                       

Yes.  See my post starting with "OK.  There is another difference that your output revealed:".

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

salleman

I think I misunderstood something.

Was I supposed to delete the geotiff tags from the file that I was fixing or the one that was more or less correct?

salleman

so, I ran the command that you gave me to delete the tags, but I'm still getting the same errors...

I apologize for being a pest, but I need to get this data fixed as soon as possible.

Phil Harvey

You were meant to delete the tags from the target file before copying.

You can use this command to see if the tags have the wrong format type:

exiftool -validate -warning -a FILE

But we still don't know if this is why GlobalMapper isn't recognizing the GeoTiff information.  Are you also setting the PixelScale and ModelTiePoint tags properly?

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

salleman

That's a good question, and not one I can really answer. The image files in question were generated by Chesapeake Technology SonarWiz... well, the ones that needed to be fixed were. I believe the one that I have with the correct projection information was generated by Blue Marble GlobalMapper.  I believe that file was pulled into GlobalMapper and re-exported with the correct projection information.

Deleting the tags from the target file didn't seem to do anything. When I copied the geo information from the good file, it ended up with the same results as before.

I'll run the validation right now. The first file "SC_04.tif" is after copying the geo data from SC_02_correctEPSG. The second file is SC_02_correctEPSG.tif.

/s/.../19031638_Orsted_SJW19_ENT/.../test $ exiftool -validate -warning -a SC_04.tif

Validate                        : 7 Warnings (5 minor)
Warning                         : [minor] Non-standard IFD0 tag 0x830e PixelScale
Warning                         : [minor] Non-standard IFD0 tag 0x8482 ModelTiePoint
Warning                         : [minor] Non-standard IFD0 tag 0x87af GeoTiffDirectory
Warning                         : [minor] Non-standard IFD0 tag 0x87b0 GeoTiffDoubleParams
Warning                         : [minor] Non-standard IFD0 tag 0x87b1 GeoTiffAsciiParams
Warning                         : Missing required IFD0 tag 0x011a XResolution
Warning                         : Missing required IFD0 tag 0x011b YResolution


/s/.../19031638_Orsted_SJW19_ENT/.../test $ exiftool -validate -warning -a SC_02_correctEPSG.tif

Validate                        : 5 Warnings (2 minor)
Warning                         : [minor] Non-standard IFD0 tag 0x830e PixelScale
Warning                         : [minor] Non-standard IFD0 tag 0x8482 ModelTiePoint
Warning                         : Missing required IFD0 tag 0x011a XResolution
Warning                         : Missing required IFD0 tag 0x011b YResolution
Warning                         : Invalid count for IFD0 tag 0x0140 ColorMap

Phil Harvey

One obvious problem here... What version of ExifTool are you using?  You should update to the current version (11.90)

- Phil

Edit: Hmmm.  The output in your first post is from 11.90, but the output in your last post is from a much older version
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

salleman

I appear to be running 10.8... I'll download the source and compile 11.9.

salleman

It looks like the Ubuntu repository version is 10.8? Anyway, here's updated output.

/s/.../19031638_Orsted_SJW19_ENT/.../test $ /home/sja/Image-ExifTool-11.90/exiftool -validate -warning -a ./SC_02_correc
tEPSG.tif

Validate                        : 3 Warnings
Warning                         : Missing required TIFF IFD0 tag 0x011a XResolution
Warning                         : Missing required TIFF IFD0 tag 0x011b YResolution
Warning                         : Missing required TIFF IFD0 tag 0x0128 ResolutionUnit

/s/.../19031638_Orsted_SJW19_ENT/.../test $ /home/sja/Image-ExifTool-11.90/exiftool -validate -warning -a ./SC_02.tif

Validate                        : 5 Warnings
Warning                         : Non-standard format (undef) for IFD0 0x87af GeoTiffDirectory
Warning                         : Non-standard format (undef) for IFD0 0x87b0 GeoTiffDoubleParams
Warning                         : Missing required TIFF IFD0 tag 0x011a XResolution
Warning                         : Missing required TIFF IFD0 tag 0x011b YResolution
Warning                         : Missing required TIFF IFD0 tag 0x0128 ResolutionUnit

Phil Harvey

Right, Wow, that's old.

OK, so now you have to repeat all your tests writing the GeoTiff tags using the current version.  That old version may not have been writing things correctly.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

salleman

YAY!!!! So the whole problem was that I was using an outdated version of exiftool? Because I reran all the same commands and everything looks perfect! 8) 8) 8) 8) 8) 8) 8) 8) 8)

Phil Harvey

Yes, that was likely the whole problem.  I do remember some fixes involving writing GeoTiff information, but that was a long while back and I can't recall the details.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).