Select to view content in your preferred language

How to load the .tfw file when opening a .tif file?

22432
10
Jump to solution
07-31-2014 12:31 AM
TorbenWiggerich
Occasional Contributor

Hi,

I have a .tif file and an extra .tfw file. How can I load the .tfw file?

From this post I could see how to load the .tif file:

https://community.esri.com/thread/93016?sr=stream&ru=3159

But how can I go further and load the corresponding .tfw file?

In ArcMap it is automatically done, but not in the ArcGIS Runtime SDK for Qt.

0 Kudos
1 Solution

Accepted Solutions
TorbenWiggerich
Occasional Contributor

It works now

Yes, this was my problem. I didn't undestood that everything is based on one spatial refernce. I changed the SpatialReference now to 4326 and it worked well. (Except that the default map is not shown any more...But this is because it is based on another SpatialReference (3857).)

Thank you very much

View solution in original post

0 Kudos
10 Replies
DanPatterson_Retired
MVP Emeritus

the *.tfw contains the spatial information for the *.tif file and it is not loaded separately but used by applications to establish the spatial reference of the image if it is used by the application

0 Kudos
TorbenWiggerich
Occasional Contributor

So this means it is automatically loaded?

When I have a map000.tif and a map000.tfw, lying in the same directory and I load the map000.tif, than the map000.tfw will be automatically loaded?

But I don't see the .tif loaded in my application. (So with another file having already the information inside the tif it will be shown correctly.)

0 Kudos
DanPatterson_Retired
MVP Emeritus

apparently the thread that you listed suggested that they don't load automatically.  Did you follow the advice in the thread?

0 Kudos
TorbenWiggerich
Occasional Contributor

Actually I followed the example from this site Raster‌ which was shown in the thread by Eric Bader.

So which advice do you mean? I didn't see any advice there...

0 Kudos
DanPatterson_Retired
MVP Emeritus

Sorry that is the one...and I guess it didn't work

0 Kudos
TorbenWiggerich
Occasional Contributor

Hmm...

sorry but which is the advice you mean?

I don't get it

0 Kudos
EricBader
Honored Contributor

Hi Torben,

It's possible that the .tfw is not being honored by the Local Server. For example, in similar fashion,  the .prj file of a shapefile is not honored.

If you start with a basemap that has the same spatial reference as your raster, add that basemap layer first to the map, then add your raster, that should help.

In a future release, you will add raster layers to your map in a more "direct read" fashion, so the Local Server will not be needed. The Local Server approach today is very very (did I say very?) limited with respect to dynamically adding ad hoc data sources to your map.

I hope this is helpful!

0 Kudos
TorbenWiggerich
Occasional Contributor

Hi,

oh sorry, the problem was that the tif was not shown because the 6 lines of the tfw file were not in the desired format. So it was shown only a very small image near the coordinates 0, 0. But the tfw file was loaded, thanks again . Changing the tfw file from the declared Longitude and Latitude to the UTM format worked.

So the problem is that I also need a version which reads the Longitude and Latitude values.

My current question is, what do I need additionally to load these files?

In the method onServiceCreationSuccess I have to change it somehow that the file will be loaded with a longitude and latitude?

0 Kudos
EricBader
Honored Contributor

Good to hear that you've identified an issue with this file.

As far as what else you need to do in your code, there isn't anything else required.

Are you able to visualize the raster in your map now?

Keep in mind, the very first layer added to your map is what determines your map's spatial reference.