【发布时间】:2019-09-19 01:11:00
【问题描述】:
我收到以下错误:
错误: SqlException:例程执行或用户定义的聚合“地理”期间出现 .NET Framework 错误: System.ArgumentException:24204:空间参考标识符 (SRID) 无效。指定的 SRID 必须与 sys.spatial_reference_systems 目录视图中显示的受支持 SRID 之一匹配。
当我尝试将这样创建的点保存到 SQL DB 时会引发此错误
new Point(it.Lat, it.Lng)
之后我尝试使用像这样的GeometryFactory:
public static class GeometryHelper
{
public static IGeometryFactory GeometryFactory { get; set; }
= NtsGeometryServices.Instance.CreateGeometryFactory();
}
...
geometryFactory.CreatePoint(new Coordinate(it.Lat, it.Lng))
什么都没有。
还尝试设置特定的 SRID:
public static class GeometryHelper
{
public static IGeometryFactory GeometryFactory { get; set; }
= NtsGeometryServices.Instance.CreateGeometryFactory(4326);
}
然后得到这个错误:
SqlException:例程执行或用户定义的聚合“地理”期间出现 .NET Framework 错误: System.FormatException:已识别元素之一的格式无效。 System.FormatException:
【问题讨论】:
标签: sql-server geospatial spatial ef-core-2.2 asp-net-core-spa-services