Problem loading spatial reference of raster

12-21-2021 08:59 AM
New Contributor II

I had a method which was working, which used GDAL to convert an ASCII grid raster into a geoTiff, and add a spatial reference so as it could be loaded into the ArcGis Runtime.

I was using GDAL 2.4.3, and ArcGis Runtime 100.8, but coming back to my code a year later it doesn't seem to work now.

I'm getting a null spatial reference when loading the geoTiff.

If anyone has any useful suggestions at this point, i'd be most grateful

0 Kudos
1 Reply
New Contributor II

So I tried to convert into a JPG instead, and suddenly things started to work.

I was also looking at an old post and realised that the JPG must store its spatial ref in the auxiliary PAM (Persistent Auxiliary Meta) file. So a hop, skip and a jump and tried to create a PAM file for the geoTiff, and that does indeed work.

This seems strange as geoTiff is capable of storing this information internally; So I'm still not sure if GDAL stopped producing the auxiliary file (but this does seem unlikely since it stores in within the geoTiff itself), or if ARCGis runtime has stopped reading it from the geoTiff... does seem strange.

So I guess I'll try to find  way to force GDAL to produce the auxiliary file...

Or does anyone know of a way to force ARCGis runtime to load from the geoTiff file.

Currently I'm using:

Raster myRaster = new Raster(outFilePath);
RasterLayer newRasterLayer = new RasterLayer(myRaster);
0 Kudos