# converting projections using dotspatial or proj4

how can i convert projections using either dotspatial or proj4? i am making a program using sharpmap and dotspatial in VB.net have to convert a EPSG 4030 into a Lambert conformal conic projection and back to WGS84 on the fly also can i convert a system on the fly using a WKT?

It's not clear from your question whether you know the proj4 string for the projection you want to convert into. DotSpatial has some built-in projections under DotSpatial.Projections.KnownCoordinateSystems, but I can't locate Lambert.

If you just want to know how to use DotSpatial, you can use code like this, passing in the proj4 strings (sorry it's in C#, but it should be easy to translate):

``````public override ReprojectPoint(ref Point[] point, string sourceProjection, string destinationProjection)
{
double[] pntXY = new double[point.Length * 2];
double[] pntZ = new double[point.Length];

for (int i = 0; i < point.Length; i++)
{
pntXY[i*2] = point[i].x;
pntXY[i*2+1] = point[i].y;

pntZ[i] = 1;
}

ProjectionInfo src = new ProjectionInfo(sourceProjection),
dst = new ProjectionInfo(destinationProjection);

Reproject.ReprojectPoints(pntXY, pntZ, src, dst, 0, point.Length);

for (int i = 0; i < point.Length; i++)
{
point[i].x = pntXY[i*2];
point[i].y = pntXY[i*2+1];
}
}

public struct Point
{
public Point(double x, double y)
{
this.x = x;
this.y = y;
}

public double x;
public double y;

public override string ToString()
{
return "POINT(" + x.ToString() + " " + y.ToString() + ")";
}
}
``````

I don't think there's any support for reprojecting WKT on-the-fly in DotSpatial - you'd need to write some code to parse it.