ThinkGeo.com    |     Documentation    |     Premium Support

Loading Tif file causing our desktop application to crash

Hello,

We have a tif files with size “8,69 MB” and with “161 MB” which when we try to load it to our WPF application it causes a crash.
GoehrdeGesamtNeu
and here is the trace log from the crash.

##############################
Application|GlobalExceptionHandler|System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.ArgumentException: The parameter you supplied may not be empty.
Parameter name: ExternalProjection.ProjString
at ThinkGeo.Core.ValidatorHelper.CheckStringIsNotNullNorEmpty(String value String parameterName)
at ThinkGeo.Core.ProjectionConverter.OpenCore()
at ThinkGeo.Core.ProjectionConverter.Open()
##############################

Any help would be great!

Big thanks,
Anwar

Hey @Anwar_Sagar,

I was able to load up your GeoTiff without issues on my side:

From the stacktrace, it looks like you are trying to do some reprojection on the geotiff. What internal and external projections were you using?

Thanks,
Kyle

Hi @Kyle_Day.

Here are our projection strings:
internalProjString = @"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
externalProjString = @"+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs";

Please provide us with the internal and external projections that you have used.

Br,
Anwar

Hey @Anwar_Sagar,

I didn’t use projection when I first tested the image because I was unsure what projection to use. I’ve since updated it. It looks like you have the projection backwards though. The internal projection is what the GeoTiff is in and the external projection is what you would like to transform it to. So, once I set it this way:

GeoTiffRasterLayer geoTiffRasterLayer = new GeoTiffRasterLayer(@"C:\Users\kyleday\Downloads\GoehrdeGesamtNeu.tif");
geoTiffRasterLayer.ImageSource.ProjectionConverter = new UnmanagedProjectionConverter(@"+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs", @"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs");

You’ll need to use the UnmanagedProjectionConverter class as some projections aren’t supported specifically by us. You might also encounter some skewing issues too when converting from that projection to decimal degree. This is the result:

Thanks,
Kyle

Hey @Kyle_Day,

Thanks you very much for testing this out.
Yes, we need to use projection with the map layer otherwise the map is shown in wrong place.
With the example map file with our guessed projection or with out the projection the map is shows in wrong place, this specific map must be in shown in Germany not in France.
The projection we used was only for testing, but it seems not the correct one. So we would like to get your help in identifying the correct projection strings for such map so it will be shown in the correct place.

Using the ordered unmanged projection string you provided it is shown in the South Atlantic Ocean.

It should be somewhere near the red dot.
image

Br,
Anwar

Hey @Anwar_Sagar,

Sure, I see that both of those GeoTiffs are in different projections. What is the projection of your base map?

Thanks,
Kyle

Hi @Kyle_Day, this is our projection externalSrid = 3857 and sorry for taking this long to replying to you. The actual problem have been fixed at our side against the older ThinkGeo version, we have not been able to take the latest version 13 into use yet.
Br,
Anwar

Hey @Anwar_Sagar,

That makes sense as to why the GeoTiff shows up in the South Atlantic. Then that means that your GeoTiff’s external projection needs to be set to 3857 instead of 4326.

GeoTiffRasterLayer geoTiffRasterLayer = new GeoTiffRasterLayer(@"C:\Users\kyleday\Downloads\GoehrdeGesamtNeu.tif");
geoTiffRasterLayer.ImageSource.ProjectionConverter = new UnmanagedProjectionConverter(@"+proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs", @"+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs +type=crs");

Thanks,
Kyle