在 NetTopologySuite 问题中检查此问题。你可以投影。
https://github.com/NetTopologySuite/NetTopologySuite/issues/346
添加到空气呼吸器的注释/代码中,您需要将 ICoordinateSystemServices 更改为 CoordinateSystemServices 并且 SRID 4326 和 3857 尚未预定义。
/*
static readonly ICoordinateSystemServices _coordinateSystemServices = new CoordinateSystemServices(
new CoordinateSystemFactory(), new CoordinateTransformationFactory(),
new Dictionary<int, string>
*/
static readonly CoordinateSystemServices _coordinateSystemServices = new CoordinateSystemServices(
new CoordinateSystemFactory(), new CoordinateTransformationFactory(),
new Dictionary<int, string>
{
[4326] = @"
GEOGCS[""WGS 84"",
DATUM[""WGS_1984"",
SPHEROID[""WGS 84"", 6378137, 298.257223563,
AUTHORITY[""EPSG"", ""7030""]],
AUTHORITY[""EPSG"", ""6326""]],
PRIMEM[""Greenwich"", 0,
AUTHORITY[""EPSG"", ""8901""]],
UNIT[""degree"", 0.0174532925199433,
AUTHORITY[""EPSG"", ""9122""]],
AUTHORITY[""EPSG"", ""4326""]]
",
//(additional projections....)
""
}
public static Geometry ProjectTo(this Geometry geometry, int srid)
{
var transformation = _coordinateSystemServices.CreateTransformation(geometry.SRID, srid);
return Transform(geometry, transformation.MathTransform);
}