您可以使用 DotSpatial 重新投影到纬度。如果您正在阅读 shapefile,并且 .prj 文件在那里以便知道投影,那么您需要做的就是:
Shapefile sf = Shapefile.OpenFile("C:\myshapefile.shp");
sf.Reproject(DotSpatial.Projections.KnownCoordinateSystems.Geographic.World.WGS1984);
但是,如果缺少 .prj 文件,则需要首先定义投影,例如:
Shapefile sf = Shapefile.OpenFile("C:\myshapefile.shp");
sf.Projection = DotSpatial.Projections.KnownCoordinateSystems.Projected.UtmWgs1984.WGS1984UTMZone32N;
sf.Reproject(DotSpatial.Projections.KnownCoordinateSystems.Geographic.World.WGS1984);
但是,例如,如果您没有 shapefile,并且只想将一组坐标从一个投影重新投影到另一个,则可以直接使用 reproject 实用程序:
// interleaved x and y values, so like x1, y1, x2, y2 etc.
double[] xy = new double[]{456874.625438354,5145767.7929015327};
// z values if any. Typically this is just 0.
double[] z = new double[]{0};
// Source projection information.
ProjectionInfo source = DotSpatial.Projections.KnownCoordinateSystems.Projected.UtmWgs1984.WGS1984UTMZone32N;
// Destination projection information.
ProjectionInfo dest = DotSpatial.Projections.KnownCoordinateSystems.Geographic.World.WGS1984;
// Call the projection utility.
DotSpatial.Projections.Reproject.ReprojectPoints(xy, z, source, dest, 0, 1);
最后一种方法使用这样的数组,以便投影模块无需直接引用数据模块即可工作。