AnsweredAssumed Answered

RasterLayer is not showing the image at right location

Question asked by JoseA82 on Nov 22, 2016
Latest reply on Nov 23, 2016 by GSCUser85



I'm developing an Android application and I'm trying to add a RasterLayer to may map containing a tif image. The map has web mercator 102100 as spatial reference and the spatial reference of the image is different (ED50 / UTM 30N). I have the .pfj, .tif and .tfw files in the same folder. This is my code to add the RasterLayer to my MapView:


String rasterPath = "<path to tif image>";
FileRasterSource rasterSource = null;
try {
   rasterSource = new FileRasterSource(rasterPath);
   RasterLayer rasterLayer = new RasterLayer(rasterSource);
} catch (IllegalArgumentException ie) {
   Log.d("IAE", "null or empty path");
} catch (FileNotFoundException fe) {
   Log.d("FNFE", "raster file doesn't exist");
} catch (RuntimeException re) {
   Log.d("RE", "raster file can't be opened");


When I run the application, the image is shown in a bad location. I think the problem is the API is not making the reprojection of the image. How does the API know the spatial reference of the image? Do I need to add any other file?


Thanks in advance