This project has moved. For the latest updates, please go here.

Misaligned raster images

Topics: SharpMap Project, SharpMap v0.9 / v1.x
Nov 18, 2013 at 10:45 AM
Hi all,

I'm trying to use SharpMap with two raster images, one from zone 50 MGA, and the other from zone 49 MGA, when I add them to the layers collection the result is an image with the two maps overlapped rather than aligned as they should be (I tested with qgis).

this image is clear:

How can I get the expected results?
Many thanks to everybody.
Nov 18, 2013 at 12:02 PM
What kind of rasters do you have? Ususally SharpMap tries to determine spatial location but that does not always work well.
Do you have some coordiante transformation set up?

If the rasters don't contain confidential information or their distribution is not restricted in any way, feel free to submit an issue, and provide the rasters in question.
Nov 18, 2013 at 1:07 PM
Both are ECW files: first EPSG:28349 - GDA94 / MGA zone 49, the other EPSG:20350 - GDA94 / MGA zone 50.

I just did another attempt at adding a third map, this is about the adjacent zone 51, but nothing, still overlapped.

Before sending the maps, they are quite big, ~417 MB, I want to know if I'm doing something wrong or incomplete, I didn't set up any transformation, I just added the maps to the layers collection:
var map = _mapBox1.Map;

var ecw1 = new SharpMap.Layers.GdalRasterLayer("zone49", "zone49_mga.ecw");
var ecw2 = new SharpMap.Layers.GdalRasterLayer("zone50", "zone50_mga.ecw");


Also, this is their projection returned from the each layers:
PROJCS["MGA49",GEOGCS["GEOCENTRIC DATUM of AUSTRALIA",DATUM["GDA94",SPHEROID["GRS80",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",111],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",10000000],UNIT["Meter",1]]

PROJCS["MGA50",GEOGCS["GEOCENTRIC DATUM of AUSTRALIA",DATUM["GDA94",SPHEROID["GRS80",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",117],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",10000000],UNIT["Meter",1]]
Thank you.
Nov 20, 2013 at 12:10 PM
Are the rasters for download somewhere? I basically think it should be possible with a little tweaking.
Nov 21, 2013 at 9:18 AM
Nov 21, 2013 at 12:48 PM
Please grab lateset SharpMap(.Extensions) source and compile yourself.

You need to adjust your code to the following:
var ecw1 = new SharpMap.Layers.GdalRasterLayer("zone49", "zone49_mga.ecw");
var ecw2 = new SharpMap.Layers.GdalRasterLayer("zone50", "zone50_mga.ecw");

var p1 = ecw1.GetProjection();
//or vice versa
var p2 = ecw2.GetProjection();

var m = _mapBox1.Map;

Nov 26, 2013 at 8:42 AM
Weird, I downloaded the last source and even by browsing I can't find that method, the only method I see is ReprojectToMap.
Nov 26, 2013 at 9:37 AM
You need to look in Branches/1.0
Nov 29, 2013 at 1:32 PM
Thank you so much, it worked!