Search This Blog

Thursday, September 8, 2011

Raster access speeds… and size limits

 

I need to be able to handle large raster images, and to be able to find values from cells very quickly.

There are many ways to do this…. here’s a look at a few:

Method Handles GeoCoords Max Size Read Access Speed
DOTSPATIAL
Raster
Yes Medium (9k x 9k) 2.6 million per second
C# dictionary No Small (5k x 5k) 50 million per second
EMGU IMGs No Large (30k x 30k) 3.2 million per second
C# BMP (.net) No Medium (9k x 9k) 1 million per second
C# FastBMP No Medium (9k x 9k) 33 million per second
Rasterlite Yes Large (internal tiling) (to do)
GDAL Yes Large (to do)
R (grids) (to do) (to do) (to do)
XNA texture No Small   (4k x 4k) (to do)

Tuesday, September 6, 2011

DotSpatial

So I’m checking out DotSpatial for use in a project.. and the first thing on my list is to check it can convert coordinate systems easily from WGS84 <> OSGB36.

Seems the current version’s inbuilt definition of OSGB36 isn’t correct.. and when using it with the Reproject method gives out some strange results. It’s also listed as failing the unit test currently.

However you can specify the details yourself.. and then it seems to work just fine… so here’s the code for taking a coordinate as OSGB36 and transforming it to WGS84…

PointD pd = new PointD();
pd.X = 326097.07;
pd.Y = 673630.932;

double [] pts_xy = new double[2];
pts_xy[0] = pd.X;
pts_xy[1] = pd.Y;

double [] pts_z = new double[1];
pts_z[0] = 0;

var pStart = new ProjectionInfo("+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894 +units=m +no_defs");
var pEnd = KnownCoordinateSystems.Geographic.World.WGS1984;
 
Reproject.ReprojectPoints(pts_xy, pts_z, pStart, pEnd, 0, 1);
System.Console.WriteLine(pts_xy[0] + " " + pts_xy[1]);