Select to view content in your preferred language

Loaded Raster Layer has a null WKID

633
4
Jump to solution
09-18-2023 08:45 AM
Labels (1)
radimbachb
New Contributor III

I'm using following geotiff raster layer sample dataset: swissALTI3D sample data - swisstopo

Direct download link: https://cms.geo.admin.ch/Topo/swissalti3d/swissalti3dgeotifflv95.zip

I would like to show this raster layer on top of a basemap. I initialize both like this, with 2056 being the spatial reference system the raster layer is based upon.

 

m_map = new Map(SpatialReference(2056), this);

QUrl imageLayerUrl("https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer");
auto baseLayer = new ArcGISMapImageLayer(imageLayerUrl, this);
auto basemap = new Basemap(baseLayer, this);
m_map->setBasemap(basemap);

const QString filepath =
	defaultDataPath() + "/ArcGIS/Runtime/Data/raster/SWISSALTI3D_TIFF_CHLV95_LN02/0.5m/SWISSALTI3D_0.5_TIFF_CHLV95_LN02_2600_1196.tif";
Raster* raster = new Raster(filepath, this);
m_rasterLayer = new RasterLayer(raster, this);

m_map->operationalLayers()->append(m_rasterLayer);

 

The resulting map only shows the basemap and not the added raster layer. The raster layer does not report any errors.

When I do not load the basemap then the raster layer is visible.

When I log the raster layer's fullExtent its json representation looks like this:

 

// auto envelope = m_rasterLayer->fullExtent();
// qDebug() << envelope.toJson();
{
    "xmin": -0.5,
    "ymin": -6999.5,
    "xmax": 6999.5,
    "ymax": 0.5,
    "spatialReference": {
        "wkid": null
    }
}

 

implying that there's an issue with the raster layer's spatial reference.

I can load this raster layer perfectly into ArcGIS Pro where it automatically gets the correct spatial reference.
Does anyone have a clue on what I might be doing wrong here?

Many thanks!

1 Solution

Accepted Solutions
GuillaumeBelz
Esri Contributor

Hello,

Non-common transformations are supported using projection engine data. All details are explained here https://developers.arcgis.com/qt/spatial-and-data-analysis/spatial-references/ and you can download data here https://developers.arcgis.com/downloads/#pedata.
You can use `TransformationCatalog::setProjectionEngineDirectory` https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-transformationcatalog.html#set... to set the path to transformation data.

const QString dataPath {"path/to/Projection_Engine_Data_200_2_0/pedata"};
TransformationCatalog::setProjectionEngineDirectory(dataPath);

 

View solution in original post

4 Replies
radimbachb
New Contributor III

The raster layer's `aux.xml` looks like this:

 

<PAMDataset>
  <PAMRasterBand band="1">
    <Histograms>
      <HistItem>
        <HistMin>621.4437255859375</HistMin>
        <HistMax>858.3682250976563</HistMax>
        <BucketCount>256</BucketCount>
        <IncludeOutOfRange>1</IncludeOutOfRange>
        <Approximate>0</Approximate>
        <HistCounts>301|396|404|416|436|452|472|476|490[...]</HistCounts>
      </HistItem>
    </Histograms>
  </PAMRasterBand>
</PAMDataset>

 

Could it be that unlike ArcGIS Pro the ArcGIS Maps SDK requires a `SRS` node in the auxiliary file as seen here Showing a georeferenced local raster · GitHub?` When I add a `SRS`, the raster layer is displayed on the map...

If so, how do I get the correct value for this `SRS` node into the auxiliary file? Can ArcGIS Pro generate it?

 

0 Kudos
radimbachb
New Contributor III

I found the corresponding .prj file here spatialreference.org | EPSG:2056 which I can use to add the SRS node to the auxiliary file. This seems to work.

However, when I use ArcGIS Pro to create a mappackage from this raster layer and try to load and display the mappackage, the raster layer again is not shown, again with its fullExtend having a null WKID. Other layers such as a graphics layer from the mappack are shown no problem...

Following is a log of the map's and the raster layer's properties:

 

MapView WKID: 2056
Map WKID: 2056
Operational "SWISSALTI3D_TIFF_CHLV95_ZURICH_2m" WKID: 0 LayerType: LayerType::RasterLayer Extent: {"xmin":-0.5,"ymin":-6999.5,"xmax":6999.5,"ymax":0.5,"spatialReference":{"wkid":null}}
Operational "Graphics Layer" WKID: 2056 LayerType: LayerType::FeatureCollectionLayer Extent: {"xmin":2684671,"ymin":1250214,"xmax":2690057,"ymax":1255309,"spatialReference":{"wkid":2056}}

 

 

0 Kudos
GuillaumeBelz
Esri Contributor

Hello,

I can reproduce the problem with raster layer. I'm investigating and I'll come back.

0 Kudos
GuillaumeBelz
Esri Contributor

Hello,

Non-common transformations are supported using projection engine data. All details are explained here https://developers.arcgis.com/qt/spatial-and-data-analysis/spatial-references/ and you can download data here https://developers.arcgis.com/downloads/#pedata.
You can use `TransformationCatalog::setProjectionEngineDirectory` https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-transformationcatalog.html#set... to set the path to transformation data.

const QString dataPath {"path/to/Projection_Engine_Data_200_2_0/pedata"};
TransformationCatalog::setProjectionEngineDirectory(dataPath);