Skip to content

Commit 6a1ed07

Browse files
authored
Merge pull request #24 from North/coordinate-system-support
Add crs support to ToDbGeometry/Geography
2 parents 50e3828 + efa7167 commit 6a1ed07

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

src/GeoJSON.Net.Contrib.EntityFramework/EntityFrameworkConvertToDbGeography.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@ namespace GeoJSON.Net.Contrib.EntityFramework
66
{
77
public static partial class EntityFrameworkConvert
88
{
9+
[Obsolete("This method will be removed in future releases, consider migrating now to the newest signature.", false)]
910
public static DbGeography ToDbGeography(this IGeometryObject geometryObject)
1011
{
11-
DbGeography value = DbGeography.FromBinary(WkbEncode.Encode(geometryObject));
12-
return value;
12+
return geometryObject.ToDbGeography(4326);
13+
}
14+
15+
public static DbGeography ToDbGeography(this IGeometryObject geometryObject, int coordinateSystemId = 4326)
16+
{
17+
return DbGeography.FromBinary(WkbEncode.Encode(geometryObject), coordinateSystemId);
1318
}
1419
}
1520
}
Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
using System.Data.Entity.Spatial;
2-
using GeoJSON.Net.Geometry;
1+
using System.Data.Entity.Spatial;
2+
using GeoJSON.Net.Geometry;
33
using GeoJSON.Net.Contrib.Wkb.Conversions;
44

5-
namespace GeoJSON.Net.Contrib.EntityFramework
6-
{
7-
public static partial class EntityFrameworkConvert
8-
{
9-
public static DbGeometry ToDbGeometry(this IGeometryObject geometryObject)
10-
{
11-
return DbGeometry.FromBinary(WkbEncode.Encode(geometryObject));
12-
}
13-
}
14-
}
5+
namespace GeoJSON.Net.Contrib.EntityFramework
6+
{
7+
public static partial class EntityFrameworkConvert
8+
{
9+
[Obsolete("This method will be removed in future releases, consider migrating now to the newest signature.", false)]
10+
public static DbGeometry ToDbGeometry(this IGeometryObject geometryObject)
11+
{
12+
return geometryObject.ToDbGeometry(4326);
13+
}
14+
public static DbGeometry ToDbGeometry(this IGeometryObject geometryObject, int coordinateSystemId = 4326)
15+
{
16+
return DbGeometry.FromBinary(WkbEncode.Encode(geometryObject), coordinateSystemId);
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)