DotSpatial (C#) re-projections - 'InitializeExternalGrids' causes .Net to 'freeze'

218 Views Asked by At

I am trying to apply an NTv2 gridshift package (OSTN15 from the UK Ordnance Survey) to some DotSpatial re-projections. This is the code I have so far:

const string Proj4_4326 = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
const string OSTN15 = @"+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +units=m +no_defs +nadgrids=D:\directory\OSTN15_NTv2_OSGBtoETRS.gsb";

static void Main(string[] args)
{
    double[] polygonPoints = new double[2] { 530624.974, 178388.464 };
    double[] zp = new double[10];

    ProjectionInfo srcProjection = ProjectionInfo.FromProj4String(OSTN15);
    ProjectionInfo desProjection = ProjectionInfo.FromProj4String(Proj4_4326);
    GridShift.InitializeExternalGrids(@"D:\directory\OSTN15-NTv2", false);

    Reproject.ReprojectPoints(polygonPoints, zp, srcProjection, desProjection, 0, 1);
}

The code gets to the 'Gridshift.InitializeExternalGrids' and 'hangs'. It appears to be processing but after 40 minutes it has built up to 2G RAM used and about 25% CPU usage constant.

I'm assuming that it should not take this long to initialise the grids and that something is going wrong.

I am using DotSpatial.Projections 1.9.0 added using NuGet, there is nothing else in the project other than this code, it is a .NET Framework 4.7.2 console app, x64 platform target (I tried x86 also).

Has anyone else had this issue or can offer any advice . Thanks.

0

There are 0 best solutions below