次のエラーが表示されます。
エラー: SqlException: ルーチンの実行中またはユーザー定義集計 'geography' 中の .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: ルーチンの実行中またはユーザー定義集計 'geography' 中の .NET Framework エラー: System.FormatException: 識別された要素の 1 つに無効な形式があります。System.FormatException: