Trying to load the tfw when opening a tif file

4016
24
Jump to solution
03-07-2017 08:06 AM
TorbenWiggerich
New Contributor III

Hello ,

I am trying to load a tif file (map000.tif) and also the correspondig tfw file (map000.tfw). 

What he actually does is, he loads the given map (map000.tif) and shows it. But I don't think that he loaded the tfw file correctly. (So loading two rasters they will be shown at the same position.)

There is no SpatialReference which I could set?

I tried to set the set SpatialReference of the Map (m_map) but it then shows nothing.

m_mapView = new MapGraphicsView( this );

QString dataPath = "<Path>\\map000.tif";
Esri::ArcGISRuntime::Raster * raster = new Esri::ArcGISRuntime::Raster( dataPath, this );
Esri::ArcGISRuntime::RasterLayer* rasterLayer = new Esri::ArcGISRuntime::RasterLayer( raster, this );

std::cout << "SpatialRefernce: " << rasterLayer->spatialReference().wkid() << std::endl;

mp_basemap = new Esri::ArcGISRuntime::Basemap( rasterLayer, this );
m_map = new Esri::ArcGISRuntime::Map( mp_basemap, this );
m_mapView->setMap( m_map );

What do I wrong?

A long time ago I had a similar question concering the SDK 10.2.3.

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

With kind regards

Torben

0 Kudos
24 Replies
TorbenWiggerich
New Contributor III

Thx, for having a look on this

0 Kudos
TorbenWiggerich
New Contributor III

Hi Luke,

after a long time, I'm coming back to this problem... Cause we need this soon...

So I made a project which is in the old 10.2.3 SDK and is able to load more tif files and the corresponding tfw files.

So here is the code again:

https://de.files.fm/u/zyq5w6td

Do I have somewho the functionality to set the desired option later on manually. So that, if no information is available in the tif File, I just tell him to use this spatial reference if no one is set.

With kind regards

Torben

0 Kudos
TorbenWiggerich
New Contributor III

By the way, if I load a tif image with the corresponding values set. Than it will be displayed at the correct postion. But if I have no information in the tif image, than it will not be displayed. I think that he even do not read any value from the tfw file.

I only have the Esri Arcgis Runtime for Qt.

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Your 10.2.3 example uses Local Server. Have you tried 100.x with Local Server? Perhaps that'll give you the expected output - arcgis-runtime-samples-qt/DynamicWorkspaceRaster.cpp at master · Esri/arcgis-runtime-samples-qt · Gi... 

If that doesn't work, I think you might want to consider contacting Esri support to work through this issue. They will be able to help troubleshoot your issue further

0 Kudos
TorbenWiggerich
New Contributor III

Yes,

with the Local Server it works . I did not know that I have to download it manually, cause it was included in the 10.2.3.

Now it works.

Thank you

0 Kudos