Jun 25, 2012 at 7:24 PM
Edited Jun 29, 2012 at 3:58 PM
|
Thanks for your help.
Could we please for once state if DotSpatial can actually reproject on-the-fly rasters or images?
I’m at least two weeks fiddling with InRamImageData, the affine coefficients and the worldfiles without any success.
Please consider the following code:
//both projections are stereographic, only the longitudes are different so it’s a 180 rotation
ProjectionInfo projSour = ProjectionInfo.FromProj4String( "+proj=stere +lat_0=90 +lon_0=180 +k=0.933 +x_0=0 +y_0=0 +ellps=WGS84
+units=m +no_defs");
ProjectionInfo projDest = ProjectionInfo.FromProj4String("+proj=stere +lat_0=90 +lon_0=0 +k=0.933 +x_0=0 +y_0=0 +ellps=WGS84 +units=m
+no_defs");
map1.Projection = projSour;
double[] affine = { -5500000, 9260, 0, 4350000, 0, -9260 };
// no world file accompanying the .bmp file but I’m specifying the affine array, with that //DotSpatial
displays the image properly
ImageData idata = new InRamImageData(“xxx.bmp”);
idata.Bounds.AffineCoefficients = affine;
idata.Projection = map1.Projection;
IMapImageLayer imageLayer = map1.Layers.Add(idata) as IMapImageLayer;
imageLayer.DataSet = idata;
// up to here everything works a charm
// here starts the reprojection of the image
idata.Reproject(projDest);
map1.Projection = projDest;
map1.Refresh();
// I’ve tried using the
Reproject.ReprojectAffine again without success:
double[] re_affine = new double[6];
re_affine = Reproject.ReprojectAffine(affine, idata.Bounds.NumRows, idata.Bounds.NumColumns, projSour, projDest);
idata.Bounds.AffineCoefficients = re_affine;
idata.Reproject(projDest);
map1.Projection = projDest;
map1.Refresh();
Thanks a lot, any hint or sample code is very welcome.
The confirmation that DotSpatial cannot reproject rasters/images on the fly is as well very welcome
Bristol
|