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
Solved! Go to Solution.
Hi Torben,
If you are able to send me the image I can try to load it to see if it works for me.
Hi Luke
I tried to upload the data here, but it is not shown...
I tried to send it to you, but I don't have the rights to do that...
So here it is...
Hi Torben - thank you for sending me through the data.
I think that the problem is that your data does not include information on the coordinate system: when you load it in a Map with no reference it ends up being displayed in Spatial Reference "0" (which as you say is not valid). In the Runtime SDK we do not support on-the-fly projection of raster data so when you try and load it into a map with a defined system (e.g. WGS84) it cannot be displayed.
For tiff files such as this one, there are a number of ways in which coordinate and projection information can be supplied. The .tfw file provides the coordinates you use in your envelope - for the coordinate system information I believe this is usually either encoded into the header of the .tif file itself or provided in a separate .aux file. Unfortunately I do not know of a straight-forward way to apply either of these approaches. If you have access to ArcMap you can use a tool such as "Define Projection" to specify the system for your file - I tried that and was able to successfully load your raster draped over another basemap in the correct location.
I hope that is helpful - I will do a little bit more research into the problem and let you know if I find a work-around.
Thanks,
Luke
Hi Luke,
it is good to hear that you can't load the image too.
With the SDK 10.2.3 I was able to load and display the image correctly. Does this change to the current release?
The way to use ArcMap is no option for us.
With kind regards
Torben
Torben,
This tiff file doesn't have a projection defined. I can see this by opening it in ArcCatalog (see attached image). If there is no projection defined, it will likely just display at 0,0 (aka null island), and all other data that doesn't have anything defined will display there as well. You will want to make sure the data has a projection defined before consuming in ArcGIS Runtime - Defining or modifying a raster's coordinate system—Help | ArcGIS for Desktop
Hi Lucas,
my current problem is that with the Runtime 10.2.3 I was able to load these images and display them at the correct position. Is this not possible with the Version 100?
Can I define it somewho in the code. Maybe that he should ever use one SpatialReference if there is no one defined?
Our customers will not have access to such a big tool (AcrGIS for Desktop).
But they should be able to load their images correctly.
I'm not sure how this worked before. It seems like the behavior that we are seeing now is expected. Can you post an example project from 10.2.3, along with sample data so we can take a look?
Hi Lucas,
sorry for my late reply...
Here is the example project:
There are two images loaded and displayed correctly.
Hi Lucas,
did you have a try on this?
Sorry Tobern, I completely missed this. I'll be pretty tied up the next 2 weeks with the User Conference (and prep for it). I will try and take a look after.
- Luke