ThinkGeo.com    |     Documentation    |     Premium Support

GeoTiff is "jumping" on zooming

Hi Hardy,

We double check it, the package should be https://www.nuget.org/packages/ThinkGeo.MapSuite.Layers.GeoTiff/11.0.0-beta016.

It looks our developer give the information for two different fix confused.

Regards,

Ethan

Ethan,

we have tested the fix:
The big bug is fixed, but now the gap is growing when moving the map.
Look at my pdf. I have zoomed to a location and panning the map down.
The gap between vector and raster will grow two times, then will fit…
That’s very strange.
If you need data I will upload some GeoTIFF and shape files.

Regards
HardyDok1.pdf (814.7 KB)

Hi Hardy,

The test data is welcome, it can saved our time to reproduced it.

And do you think that’s introduced by this fix?

Regards,

Ethan

Ethan,

you’ll find the shapes in the north of the GeoTIFF area.
Zoom must be 1:50 or lower.

Hope you will fix the bug asap…

Regards
Hardythinkgeo.zip (884.7 KB)

Hi Hardy,

We will handle it in high priority.

Here is the test code for your data, please have a look at it, if the projection usage is different with your scenario please let me know.

 winformsMap1.MapUnit = GeographyUnit.Meter;
        winformsMap1.MinimumScale = 1;
        
        winformsMap1.ZoomLevelSet = GetCustomZoomLevelSet(10000);

        string prjstring = File.ReadAllText(@"..\..\AppData\stellen_Polygon.prj");

        Proj4Projection proj4 = new Proj4Projection();
        proj4.InternalProjectionParametersString = Proj4Projection.ConvertPrjToProj4(prjstring);
        proj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString();
        proj4.Open();

        //Tiff layer
        GeoTiffRasterLayer tifflayer = new GeoTiffRasterLayer(@"..\..\AppData\bevenrode.tif");
        tifflayer.Open();
        winformsMap1.CurrentExtent = tifflayer.GetBoundingBox();

        //Shape layer
        ShapeFileFeatureLayer.BuildIndexFile(@"..\..\AppData\stellen_Polygon.shp", BuildIndexMode.DoNotRebuild);
        ShapeFileFeatureLayer shplayer = new ShapeFileFeatureLayer(@"..\..\AppData\stellen_Polygon.shp");
        shplayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
        shplayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
        shplayer.Open();
        shplayer.FeatureSource.Projection = proj4;


        LayerOverlay ImageOverlay = new LayerOverlay();



        ImageOverlay.Layers.Add("WorldImageLayer", tifflayer);
        ImageOverlay.Layers.Add(shplayer);
        winformsMap1.Overlays.Add(ImageOverlay);

Regards,

Ethan

Hi Hardy,

Our developer hadn’t fixed it because it’s more complex than we thought.

But we provide a workaround here:

7899.zip (884.1 KB)

And here is how it looks now:

BTW, we found a small jump which is because TIF file is more exactly than pixel, vector draw based on pixel. We discuss it, it looks we cannot solve it based on currently render logic, but It won’t effect the result because it’s in very deep level.

Regards,

Ethan

Hi Ethan,
i have checked the workaround.
The result is not ok.
You should test rasterhandling using the correct projection. Both are EPSG 25832.
If you do so you will get bad results.
And the Raster is jumping all over the world…
The issue is based on the projection.
But we need to use projection, any project we are in will use 25832 or 25833 as Base Coordinate System.

Hope you can get it right.

Regards
Hardy

Hi Hardy,

Our developer found the two layer cannot cover when set projection like the sample code I mentioned, so they hadn’t added it.

I will look at it again.

Regards,

Ethan

Hi Ethan,
to use projected Datasets I think I have to project them:
Base Coordinate System (internal) for MapSuite is EPSG:=3857 or 900913…correct?
When adding a layer I must set projection like

proj4.InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(25832);
        proj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString();

correct?
So I have to do this each time adding a projected layer?
Am I wrong?
How to handle multiple layers with different projection?

I think, that’s the question.

We use several layers in different projection and digitize vector data on the raster, storing the vector geometry in PostGIS.
When reading the captured data with ohter GIS (like QGIS) the results are correct.
So why not project both layer?

I’m a bit confused about “…the two layer cannot cover…”

Regards
Hardy

Hi Hardy,

I want to apologize for I hadn’t describe it clearly.

At the beginning we thought your shape file is not the same projection with your geotiff file, so we only set projection to the shape file(it contains the prj file). That’s why I mentioned the two layer cannot cover.

And after that when our developer implement the workaround, they ignore the projection, so you are right, if assign projection the jump appears obvious.

Just like I mentioned, it’s hard totally fix the not match between raster and vector layer, so the project magnify the not match result, that’s why we watch the jump after reproject.

I will ask our developer to research it and see how to provide a solution or workaround.

Please wait my update.

Regards,

Ethan

Hi Hardy,

Because we will have one day vacation, so our developer will back 3 days later. I want to update the status of this problem.

Because the different of tiff tile and screen pixel, the raster layer cannot totally match vector layer, that’s the reason of the “jump”.

After reprojection, the jump is watched easier because this process enlarged the error, the workaround we provided before is try to reduce the jump range by set a offset, and it don’t works after reproject because we need move this process to DrawImageCore instead of GetImageCore.

But we are thinking another solution for it, if this solution still don’t works, we have to get back the workaround and try to find a better value for different levels.

Regards,

Ethan

Hi Hardy,

Our developer had fixed this issue, it don’t need the workaround now, we fixed some bugs related with it and when test it works better than before.

Please get the packages:


and

when they are avialiable in NuGet, any question please let us know.

Regards,

Ethan

Hi Ethan,

I have installed the new packages.
Working fine.

But now we get some problems when loading/displaying raster in different scales:
Zooming out from 1:500 to 1:1000 the raster will be displayed as stripes…

Exporting the map to GeoTIFF and reloading (remember my last post) will not display the GeoTIFF. But zooming out three or four times the GeoTIFF will be displayed as stripes.

It seems to me an issue with compression from raster.

Attached you’ll find an exported GeoTIFF. (EPSG 25832).

Please try to load that file with your Printing Example.
Zoom around…you should get the issue.

Regards
HardyTemp.zip (1.1 MB)

in addition a screen shot showing the issue from production area…

Have fun…

Hi Hardy,

Thanks for your update.

It looks when I tested it the simple code cannot render the tiff file.

        map.MapUnit = GeographyUnit.Meter;

        GeoTiffRasterLayer layer = new GeoTiffRasterLayer(@"D:\tmpB35.tif", @"D:\tmpB35.tfw");
        layer.Open();
        map.CurrentExtent = layer.GetBoundingBox();

        LayerOverlay overlay = new LayerOverlay();
        overlay.Layers.Add(layer);

        map.Refresh();

Our developer will looks into it, try to reproduce your issue and solve it.

Any update I will let you know.

Regards,

Ethan

Hi Hardy,

Please try this package: https://www.nuget.org/packages/ThinkGeo.MapSuite.Layers.Wmts/11.0.0-beta018

It should solved this new problem.

Regards,

Ethan

Hi Ethan,

it’s working.
Many thanks for your support.

Best regards
Hardy

Hi Hardy,

I am glad to hear that works.

Any question please let us know.

Regards,

Ethan

Hi Ethan,

sorry for getting back to this issue.
But when using a GeoTIFF File without TFW File and loading a TrackOverlay the raster will be shifted.
Removing the TrackOverlay the raster will go back to it’s legal position…
Very strange…

I have tested that behaviour with several tif files.
Only when using tfw the raster will keep the correct position.

So I have generated tfw files for all tif files in my project…

Maybe you can check that.

Regards
Hardy

Hi Hardy,

Thanks for your information. We tried to remove TrackOverlay follow you mentioned, but we hadn’t reproduced the issue. We tested the “bevenrode.tif” without “.tfw” file.

If you think we miss any step please point out, any code or sample is helpful.

And this post is too long, if you think we need to disucss about it further, could you please create a new post about it?

Thanks,
Rex