ThinkGeo.com    |     Documentation    |     Premium Support

V12.1 - Raster Projected Results in Blank Areas

ThinkGeo Team,

I’ve implemented a ProjectionConverter for a RasterLayer (MrSid, GeoTiff, JPeg2000) using ThinkGeo.Core.UnmanagedProjectionConverter.

The initial rendering of the raster is fine, but as ZoomOut’s occur the rendering contains blank areas. The screen-captures below show this.

This is the code:

TheAssetsStatic.gProjectionConverterForRendering = new UnmanagedProjectionConverter(4326, 3857);
MrSidLayer = new MrSidRasterLayer();
MrSidLayer.ImagePath = ThePath;

TheAssetsStatic.aTheLayerOverlay.Layers.Add(MrSidLayer);
MrSidLayer.ImageSource.ProjectionConverter = TheAssetsStatic.gProjectionConverterForRendering;

This issue occurs for MrSid’s. I am still testing with GeoTiff and JPeg2000.

Testing with JPeg2000 results in no image at all being rendered.

Testing with GeoTiff results in same issue as shown in screen-captures below.

Thanks,
Dennis

Initial rendering at ZoomLevel17

ZoomLevel16

ZoomLevel15

ZoomLevel14

ZoomLevel13

GeoTiff
ZoomLevel17

ZoomLevel17 - without ProjectionConverter

Thanks Dennis,
I created a sample for you to load the ECW, MrSid, GeoTiff, JPeg2000 And Projection Convert. Demo.zip (1.2 MB)
To re-project the raster layer we’d better use overLay.TileType = TileType.SingleTile;

Here is what it looks like.

Thanks

Frank

Frank,

I download the demo. I compiled with .NET V4.7.2 because the version it came with is not installed on my machine.

I experimented with your MrSid raster. That raster is not a very good example because it is only really renderable at ZoomLevel01.

So I modified the code to use one of my MrSid Raster files. Below is a screen-capture that displays an error stating “the input double value is out of range, parameter name: canvasWidth”.

I removed the ProjectionConverter and the raster rendered as shown below. Zooming In/Out worked fine.

Some time ago I had uploaded all of my rasters to http://clients.thinkgeo.com, but that website is not reachable anymore. Do you still have a client upload site or has the site been renamed?

Attached is my modified MainWindow.xaml.cs from the Demo project.

Also, I changed my application from using MultipleTile to SIngleTile and it works better, but there are still issues.

Regards,
Dennis

MainWindow.xaml.cs (4.0 KB)

Thanks Dennis,
http://clients.thinkgeo.com has been discontinued. You could either create a private ticket to upload the files. Or you could use the google drive to share the files and send the link to support@thinkgeo.com

I will look into more detail. Once I get the data file.

Thanks

Frank

Frank,

I just sent an email with a DropBox link to one of my MrSid rasters.

Dennis

Thanks Dennis,
The reason you see the error is the file already Meter projection. So if you treat is as 4326(decimal degree) and covert to the 3857(Meter). It will convert the lat/lon value to a very big value. Then it will get some out of range error.

I looked into more detail about your file. actually it is 3435 projection. https://epsg.io/3435

How we find the projection in the files? If you have Gdal install you can run the command line

Then google “nad83 / illinois east (ftus) epsg code”. You will find the EPSG code is 3435.

In mapsuite we don’t need know exact EPSG code. We could use the following code to get the original projection information.
MrSidLayer.Open();
var projection = MrSidLayer.Projection;

So for you case you could do like this

map.MapUnit = GeographyUnit.Meter;
map.CurrentExtent = MaxExtents.SphericalMercator;

        var MrSidLayer = new MrSidRasterLayer(System.AppDomain.CurrentDomain.BaseDirectory + "\\14LakeView2008.sid");
        MrSidLayer.Open();
        var projection = MrSidLayer.Projection;

        var gProjectionConverterForRendering = new UnmanagedProjectionConverter(projection.ProjString, 3857);
        gProjectionConverterForRendering.Open();

        MrSidLayer.ImageSource.ProjectionConverter = gProjectionConverterForRendering;
        var overLay = new LayerOverlay();
        overLay.TileType = TileType.SingleTile;
        overLay.Layers.Add(MrSidLayer);
        map.Overlays.Add(overLay);
        map.CurrentExtent = MrSidLayer.GetBoundingBox();

        map.Refresh();

Thanks

Frank

Frank,

Thanks for the tip on the actual coordinate system of 3435. In fact I use the below projection string. Is this the same as, or equivalent to, 3435? I read your response again and it looks like you said yes, these are the same. Apologies for the confusion on this.

PROJCS["NAD_1983_StatePlane_Illinois_East_FIPS_1201_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",984250.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-88.33333333333333],PARAMETER["Scale_Factor",0.999975],PARAMETER["Latitude_Of_Origin",36.66666666666666],UNIT["Foot_US",0.3048006096012192]]

I changed the Demo project to use 3435 and it now displays the raster and Zoom In/Out works just fine.

I then changed it from SingleTile to MultipleTile and the blank areas appear at ZoomLevel15 as shown in the screen-capture below…

Using 3435 in my application with MultipleTile I continue to see the blank areas. I changed it to SingleTile and the blank areas do not appear.

I may be confused about the Projection of the MrSid Raster, but this is how I’ve done it in MapSuite and it was never a problem.

So it would appear there is an issue with MultipleTile when using a ProjectionConverter.

Regards,
Dennis

Frank,

I’m noticing more unusual behavior in my application all centered around ProjectionConverter.

Below are three pictures. The first is the starting point, then the map was panned to the right resulting in the second picture. Then the map was panned to the right again resulting in the third picture.

TileType = TileType.SingleTile

Dennis

Thanks Dennis,
I did some test with mapsuite V10 it works good. This turn out it is a bug for the V12. We are looking into more detail.

Thanks

Frank

Thanks for the update Frank!

Frank,

I’ve noticed what I feel is another issue, but may be related to the others.

The rendered extent of a MrSid using just its’ ‘native’ project is different that when setting a ProjectionConverter and using 3857. In MapSuite no matter the projection the same extent is rendered.

The rendered extent using 3857 is the correct rendering as it matches MapSuite.

Below are two screen-captures that show this.

Thanks,
Dennis

Rendered with ‘native’ projection:

Rendered with ProjectionConverter using 3857 as External Projection.

Frank,

I’ve come upon another issue for TIFF and JPEG2000 rasters, but not an issue for MrSid.

I can display TIFF and JPEG2000 with their ‘native’ projection. However, using a ProjectionConverter with external projection set to 3857 results in the below error:

image

If the external projection is set to 3435 the raster is rendered.

This is the code that is used for all three raster types.

                TheLayer.Open();
            TheProjectionInternal = TheLayer.Projection;
            TheLayer.Close();

            // set Internal Projection to that of Layer
            TheAssetsStatic.gProjectionForRenderingInternal            = new Projection();
            TheAssetsStatic.gProjectionForRenderingInternal.ProjString = TheProjectionInternal.ProjString;

            // set External Projection to that of Selected
            TheAssetsStatic.gProjectionForRenderingExternal            = new Projection();
            TheAssetsStatic.gProjectionForRenderingExternal.ProjString = Projection.ConvertEpsgToProjString(3857);

            TheAssetsStatic.gProjectionConverterForRendering = new ThinkGeo.Core.UnmanagedProjectionConverter();
            TheAssetsStatic.gProjectionConverterForRendering.InternalProjection = TheAssetsStatic.gProjectionForRenderingInternal;
            TheAssetsStatic.gProjectionConverterForRendering.ExternalProjection = TheAssetsStatic.gProjectionForRenderingExternal;

            TheRasterLayer = (ThinkGeo.Core.RasterLayer)TheLayer;
            TheRasterLayer.ImageSource.ProjectionConverter = TheAssetsStatic.gProjectionConverterForRendering;

Regards,
Dennis

Dennis,
I have fixed the MrSid. I am doing more testing. I will let you know once it available for the Nuget.

Thanks

Frank

Thank you Frank.

Dennis

Thanks Dennis,
We have done the test. Please update thinkgeo related nuget package to the latest beta one. It should work now.

Thanks

Frank

hi Frank,

I’ve updated the following… Is this all that needs updating?

image

MrSid appears to be much better, but I have more testing to do.

Did you do anything with TIFF & JPEG2000 issues? They still do not work with reprojection using 3857.

Dennis

hi Frank,

The original issue I reported and the second one concerning panning appear to be fixed.

However, the last two issues I reported are still not working.

Thanks,
Dennis

Thanks Dennis,
Yes. We are working on those two. I will update you once I get some progress.

Thanks

Frank

Dennis,
Could you send us the TIFF & JPEG2000 file by private ticket or send the download link to support@thinkgeo.com.

Thanks

Frank

I had sent the link the other day. Give me a minute and I’ll send again.