Hi,
try to pass also the extent.
If you download dotspatial sources and open the vectortoraster.cs file you find the following code in the toraster method:
since your envelope height and width might be not a multiple of the cellsize you specified, it might turn out that the newly created raster will not have the discretization you want.
Have a look into the ToRaster method and see what it does to understand it. The cellsize is never used after the evaluation of w and h, hence I guess that the output raster cellsize is re-evaluated from w,h and the envelope.
A simple test would be to pass an envelope which has a width and height exactly multiple of the cellsize you want. Then the results should be what you are looking for.
Hope I've been clear
Oscar
try to pass also the extent.
If you download dotspatial sources and open the vectortoraster.cs file you find the following code in the toraster method:
public static IRaster ToRaster(IFeatureSet fs, Extent extent, double cellSize, string fieldName,
string outputFileName,
string driverCode, string[] options, IProgressHandler progressHandler)
{
Extent env = extent;
if (cellSize == 0)
{
if (env.Width < env.Height)
{
cellSize = env.Width / 256;
}
else
{
cellSize = env.Height / 256;
}
}
int w = (int)Math.Ceiling(env.Width / cellSize);
if (w > 8000)
{
w = 8000;
cellSize = env.Width / 8000;
}
int h = (int)Math.Ceiling(env.Height / cellSize);
if (h > 8000)
{
h = 8000;
}
......
you should test the following instructions to understand if the Toraster method will return to you the results you are looking for:int w = (int)Math.Ceiling(env.Width / cellSize);
int h = (int)Math.Ceiling(env.Height / cellSize);
I didn't test it but I guess thatsince your envelope height and width might be not a multiple of the cellsize you specified, it might turn out that the newly created raster will not have the discretization you want.
Have a look into the ToRaster method and see what it does to understand it. The cellsize is never used after the evaluation of w and h, hence I guess that the output raster cellsize is re-evaluated from w,h and the envelope.
A simple test would be to pass an envelope which has a width and height exactly multiple of the cellsize you want. Then the results should be what you are looking for.
Hope I've been clear
Oscar