This project is read-only.

on-the-fly reprojections for rasters or images

Jun 25, 2012 at 8:24 PM
Edited Jun 29, 2012 at 4: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


map1.Projection = projDest;


// 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;


map1.Projection = projDest;



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


Jun 27, 2012 at 6:11 PM
Edited Jul 3, 2012 at 4:30 PM


Jun 29, 2012 at 4:57 PM
Edited Jul 3, 2012 at 4:30 PM


Jul 3, 2012 at 4:31 PM

8 days without reply