2.0版发生了什么?我的主要考虑是:
ICoordinateSystem接口在哪里(如何使用NTS实现从一个坐标系到另一个坐标系的几何转换)?发布于 2020-10-01 21:32:38
2.0版发生了什么?
你可以把大多数的问题都归咎于我,因为大多数问题听起来都是这样。
通常,请参阅https://github.com/NetTopologySuite/NetTopologySuite/wiki/Upgrading-to-2.0-from-1.x了解NetTopologySuite 2.0中更改的细节,包括如何从旧的东西迁移到新的东西,并简要解释为什么我们推动导致这么多痛苦的更改。
我们就这个话题进行了大量的讨论:https://github.com/NetTopologySuite/GeoAPI/issues/70
简略版:听起来像是一个很好的主意,让这个单独的GeoAPI项目作为几何学的抽象,但是在我们使用它的10年中,很明显没有人是实际上是,把它作为独立于NTS的东西使用。
它给我们带来了很大的摩擦,让新用户感到困惑,最终NTS本身已经是几何学的抽象,所以我主张我们消除它,同时我们已经在为v2做其他突破性的修改了。
ICoordinateSystem接口在哪里(如何使用NTS实现从一个坐标系到另一个坐标系的几何转换)?
这个东西是由ProjNet4GeoAPI实现的。由于我们不再维护以前称为GeoAPI的东西,所以我们开始在"ProjNet“包下发布这个包,该包在迁移到v2时也有类似的更改。
坐标系统的抽象现在是抽象类ProjNet.CoordinateSystems.CoordinateSystem。
非常、非常相关的另一个问题是,我们最终在v2转换中实现了:https://github.com/NetTopologySuite/GeoAPI/issues/68。
发布于 2019-11-06 08:37:55
在NetTopologySuite问题中检查此问题。你可以投射。https://github.com/NetTopologySuite/NetTopologySuite/issues/346
添加到airbreather的注释/代码中,您将需要将您的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);
}https://stackoverflow.com/questions/57768118
复制相似问题