Select to view content in your preferred language

Raster layer loading in wrong coordinates

747
6
06-22-2023 03:52 AM
ofirrosner
New Contributor III

Hello
im using 100.12 using WPF

in my project im asking from out server from a raster file(TIF file)
when i get back the file from the server ,and loads it to the operational layer/base layer it load(it load correctly with the render i want and in the size i asked)in a different place from where i expect (i know this because im sending the server the coordinate that i want the raster to be in, furthermore when i load the  file into another GIS program(like QGIS) its does load in the place i expected it to be )

i roughly use the Colormap Render example from you examples
both raster and raster layer are Loaded without any error and i do see the spatial reference (SpatialReference.WkText)

P.S
i have a hunch that its somehow related to Spatial Reference, my project can use 4 of them
Wsg84,2056,21781,4320 
in all 4 Spatial References i still have the same issue




Tags (2)
0 Kudos
6 Replies
DiveshGoyal
Esri Regular Contributor

It's possible that the spatial reference embedded in the tiff file is not being picked up.
Can you print the value reported by the RasterLayer.spatialReference property after the raster is loaded?
Can you share the file with us so that we can investigate? You can attach it in this thread or directly message it to me.

0 Kudos
ofirrosner
New Contributor III

Hi
SpatialReference.WkText =>

"PROJCS["CH1903+_LV95,GEOGCS["GCS_CH1903+",DATUM["D_CH1903+,SPHEROID["Bessel_1841,6377397.155,299.1528128]],primem["Greenwich",0,0],UNIT("Degree,0.0174532925199433]],PROJECTION["Hotline_Oblique_Mercator_Azimuth_Center],PARAMETER["false_easting,2600000.0],PARAMETER["false_northing",1200000.0],PARAMETER["scale_factor",1.0],PARAMETER["azimuth",90.0],PARAMETER["longitude_of_center,7.743287037037036],PARAMETER["latitude_of_center",47.59001543209878],UNIT["Meter",1.0]"


SpatialReference.BaseGeographic => Wkid=4150

SpatialReference.Wkid = 0

I cannot add the file itself due to company policy 

0 Kudos
DiveshGoyal
Esri Regular Contributor

That helps. Looks like the spatial reference of the geotiff is being correctly detected. 
However, it appears to be a custom spatial reference - it does not have a wkid, and it's wkt is different from the standard CH1903+_LV95 projected coordinate system. This could be causing the reprojection issues. 


Can you open the file in ArcGIS Pro and check if it aligns correctly there? 
Is there an option for you to generate the tiff file in the standard CH1903+_LV95 coordinate system (wkid=2056)?

0 Kudos
ofirrosner
New Contributor III

In arcgis pro (version 2.8) it load correctly(i,e in the same location i asked for)(with the same map)

i will try and investigate the backend side of my request

p.s
is there any i can re-project the  raster after i get it from the backend?

0 Kudos
DiveshGoyal
Esri Regular Contributor

The API automatically reprojects raster layers on-the-fly when required to match the map's spatial reference. There is no way in the API to reproject and save the raster to disk.

You can use Pro to reproject the raster and save it as a new file.

0 Kudos
ofirrosner
New Contributor III

As i mentioned 
In Arcgis pro(version 2.8) with the same map that i was in my software it renders in the right place
i have no idea why it render in the wrong place when i load it

p.s
i bypassed the problem by making a bmp out of the raster and load it to the map with PictureMarkerFillSymbol

0 Kudos