05-18-2016 08:32 PM
I have thousand Tiff files and many of them come with bad geotiff tags. Some of them don't have projection defined, some of them have different projection units and some of them come with wrong x,y pixel centre values...
When I load these tiff in IMAGINE they are scatted all over the world..
I have TFW files for all of the Tiffs, my question is: is there a way to fix the Tiffs with the TFW files that I have?(let's hope these TFW are all good).
P.s. I have heard that you can strip off the bad geotiff tags first and then reassign as per the TFW definition... Anyone had done it before?
Solved! Go to Solution.
05-19-2016 12:15 AM - edited 05-19-2016 12:21 AM
I would try two methods:
1) Delete map model method by tools
2) Second brute force method if previous will not take map models out
The point is that TIF TAG's tends to be bit sticky sometimes and it well might be that they will not get lost in method 1. Just converting tif's to new tif's will not help as Imagine always writes GeoTIF tags and if you write new tif's there is a big change that wrong tags will follow. Also one issue here is that Imagine always respects coordinates found inside files more than world files which means that you must somehow get rid of internal coordinates before world file is applied.
As a enhancement request for this it would be nice to have
1) Write TIF without geotif headers - if my solution 1 works then it is a good workaround for this
2) Option to choose in file opening do we respect internal or world file based coordinates
Any other ideas or solutions to this challenge?
05-23-2016 02:37 PM
I tried both of the methods you suggested, didn't quite work for me.
However we have discovered a workflow that works, here is the workflow:
@echo off rem Change geotif tags to input twf (world) file and proj4 string (currently hard coded to NZTM). rem rem S.Falconer rem 2016 rem rem Requires ISRU (Free with GeoMedia or free from Intergraph website) rem rem rem example: rem ChangeGeotiffTie.bat D:\data\images\newurban\ D:\data\images\newurban\fixed\ setlocal set PATH=C:\Program Files (x86)\ISRU\bin;C:\Program Files (x86)\Common Files\ZI Imaging;C:\Program Files (x86)\Common Files\Intergraph;%PATH%; set in_dir=%~1 set out_dir=%~2 if "%out_dir%"=="" set out_dir=%in_dir% rem set in_dir=C:\Data\client\mcc\images\ rem set out_dir=C:\Data\client\mcc\images\out\ REM - Add geotif tie from world file via -E REM - Add coordiante ssytem definition with units via proj4 definition via -4. Following is setting NZTM with units in meters for %%a in ("%in_dir%\*.tif") do geotifcp -4 "+proj=tmerc +lat_0=0 +lon_0=173 +k=0.9996 +x_0=1600000 +y_0=10000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs" -e "%in_dir%\%%~na.tfw" "%in_dir%\%%~nxa" "%out_dir%\%%~nxa" rem popd endlocal
Hope it helps.