Skip to main content
Question

merge (.tif) image into one GeoTIFF

  • February 22, 2018
  • 9 replies
  • 296 views

I have 10 image in a (.tif) format without coordinate system. I would like to get the same result in the link below, that is, in my case, a final output to the 10 images merged into one GeoTIFF file.

https://knowledge.safe.com/articles/22971/basic-raster-mosaicking.html

When I had add the reader, I have select the multiple images, but the images overlap each other in the same position. How can I solve this and then get the final output?

9 replies

daveatsafe
Safer
Forum|alt.badge.img+19
  • Safer
  • February 22, 2018

Hi @afme,

In order to properly merge the images, you will need to georeference them. If you can find .tfw files for the TIFFs, FME can use those to automatically georeference the images. If not, you can do it in the workspace, using the RasterGeoreferencer transformer. If you do not know the ground locations of the images, but do know how they should be arranged in the output image, you can just set the upper left coordinates of the image so that they line up correctly, leaving the X and Y spacing set to 1.

For example, if your images are 1000*1000 pixels, the upper left image would have its upper left set to 0,0. The image abutting it to the right would be set to 1000,0, while the image below it would be set to 0,-1000, and so on.


itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • February 22, 2018

Hi,

You need to re-position the rasters first before combining. From experience its easier just to re-create the world files and let FME read the rasters in position.

Otherwise you need to think about an affine transformation or wrapping them into position.

The world files are just text files with several parameters. If you can find the correct values and use them to create world files, putting the rasters together is easily done.

Hope this helps.


  • Author
  • February 22, 2018
daveatsafe wrote:

Hi @afme,

In order to properly merge the images, you will need to georeference them. If you can find .tfw files for the TIFFs, FME can use those to automatically georeference the images. If not, you can do it in the workspace, using the RasterGeoreferencer transformer. If you do not know the ground locations of the images, but do know how they should be arranged in the output image, you can just set the upper left coordinates of the image so that they line up correctly, leaving the X and Y spacing set to 1.

For example, if your images are 1000*1000 pixels, the upper left image would have its upper left set to 0,0. The image abutting it to the right would be set to 1000,0, while the image below it would be set to 0,-1000, and so on.

Hi @DaveAtSafe ,

 

Thank you for your answer, I know I need to georeference them, if I had the georeferenced images I'd ve merge them with a GIS software on which I am more familiar.

 

I was looking in FME the possibility of automatically merging multiple images like Photoshop's photomerge function.

 

Otherwise I can try to follow your suggestion about the setting the upper left coordinates and so on

 

 


  • Author
  • February 22, 2018
itay wrote:

Hi,

You need to re-position the rasters first before combining. From experience its easier just to re-create the world files and let FME read the rasters in position.

Otherwise you need to think about an affine transformation or wrapping them into position.

The world files are just text files with several parameters. If you can find the correct values and use them to create world files, putting the rasters together is easily done.

Hope this helps.

Hi @itay

 

Thank you, but I don't think I have any idea how it is possible to create (or re-create) world files :(

 

 


itay
Supporter
Forum|alt.badge.img+17
  • Supporter
  • February 23, 2018
afme wrote:
Hi @itay

 

Thank you, but I don't think I have any idea how it is possible to create (or re-create) world files :(

 

 

Have a look at the link I posted (world files) to get a better idea about them.

 

@DaveAtSafe 's Idea on the upper left corner is a good way to start.

 

 


redgeographics
Celebrity
Forum|alt.badge.img+49
itay wrote:

Hi,

You need to re-position the rasters first before combining. From experience its easier just to re-create the world files and let FME read the rasters in position.

Otherwise you need to think about an affine transformation or wrapping them into position.

The world files are just text files with several parameters. If you can find the correct values and use them to create world files, putting the rasters together is easily done.

Hope this helps.

Just an addition to that link @itay posted: the 5th and 6th line of a TFW file contain the coordinates of the center of the top-left pixel.

 


  • Author
  • February 26, 2018
itay wrote:
Have a look at the link I posted (world files) to get a better idea about them.

 

@DaveAtSafe 's Idea on the upper left corner is a good way to start.

 

 

where I find information about world files?

 

I only can see these, but information are the same for every image!

 

 

so I think @DaveAtSafe 's Idea on the upper left corner can't work..

 

 

 


redgeographics
Celebrity
Forum|alt.badge.img+49
afme wrote:
where I find information about world files?

 

I only can see these, but information are the same for every image!

 

 

so I think @DaveAtSafe 's Idea on the upper left corner can't work..

 

0684Q00000ArNLxQAN.png

 

 

Yes it can, but you'll have to fake the coordinates. Best is to use the pixels for those (1 coordinate unit = 1 pixel), so the world file for the first file could be

 

0.5 0 0 13823.5 0.5 -0.5

 

and the one for the file immediately to the right of that one could be:

 

7680.5 0 0 13823.5 0.5 -0.5
That way you're sort-of georeferencing them in an arbitrary space.

  • Author
  • February 27, 2018

I can see from the translation log after running with the GUI that there is a plugin imported that allows the readers to operate. How can I incorporate this plugin while running with command line interface?

Here is the output from command line:

fme "C:\FME\my.fmw" --BlockNameLookup "C:\FME\BlockNameLookup.csv" --DWG_InputFile "C:\FME\my.dwg" --DWG_MetaData_File "C:\FME\my.dwg" --DB_Input_CSV "C:\FME\my.csv" --PostGIS_DB_Connection "DEFAULT_NO_CONNECTION" --FEATURE_TYPES "" --FME_LAUNCH_VIEWER_APP "YES"
                FME 2023.1.1.1 (20231011 - Build 23636 - WIN64)
                        FME Form Fixed (node locked-crc)
                               Permanent License.
                        Machine host name is: mymachine
     Operating System: Microsoft Windows Server 2022 64-bit  (Build 20348)
                 Copyright (c) 1994 - 2023, Safe Software Inc.
                               Safe Software Inc.
 
Translation FAILED with 1 error(s) and 3 warning(s) (0 feature(s) output)
 
Module 'acad/ACAD' is unavailable for use with this FME edition
Program Terminating
 
Translation FAILED.

The command line attempt was run with the 'Command line to run this workspace' printed at the top of the translation log. Here is a snip from the log after a successful run of the workspace with the GUI. I think this is the piece I'm missing for the CLI run.

Creating reader for format: 
MULTI_READER(MULTI_READER): Will fail with first member reader failure
MULTI_READER(MULTI_READER): Adding ACAD Reader with keyword ACAD_2
MULTI_READER(MULTI_READER): Adding ACAD Reader with keyword ACAD_3
MULTI_READER(MULTI_READER): Adding CSV2 Reader with keyword CSV2_5
Using Multi Reader with keyword `MULTI_READER' to read multiple datasets
Creating reader for format: Autodesk AutoCAD DWG/DXF
Trying to find a DYNAMIC plugin for reader named `ACAD'
Loaded module 'ACAD' from file 'C:\Program Files\FME\plugins/acad/ACAD.dll'
FME API version of module 'acad/ACAD' matches current internal version (4.0 20230426)
ACAD_2 Reader: Using rich geometry.
AutoCAD Reader: Successfully opened the 'Release2018' AutoCAD file 'C:\FME\my.dwg'

Additionally, I have confirmed that the FME directory that is listed for module loading is including in my PATH environment variable.

 

Thanks!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings