Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Spatial Data Types in asp.net vnext with EF 7?

in vnext, using Entity Framework 7 (https://github.com/aspnet/EntityFramework) how to use Spatial Data types (e.g. DbGeography) in model (code-first method) to save points, shapes etc. when creating model for a table.

e.g.

public DbGeography gps_points {get; set;}

I'm unable to use DbGeography.


Update:

Confirmed, this feature is not yet available in EF7, but may be available in future versions.

to track any changes see:

https://github.com/aspnet/EntityFramework/issues/242

https://github.com/aspnet/EntityFramework/issues/1100

like image 554
Vijayant Katyal Avatar asked Nov 19 '14 03:11

Vijayant Katyal


1 Answers

Referring to your own issue at the github repository of Entity Framework, there seems no implementation, yet. As the milestone was set to "Backlog" it seems that this issue won't be resolved in the near future.

If you do not need to process your data geographically on database-side (e.g., search in a bounding box or intersections), you can save your data as Well-known text. This can be easily converted to a database geometry type, if EF7 supports spatial data in the future.

Be aware of the string length limits of your database, since WKT can get quiet long for complex shapes.

like image 64
ischas Avatar answered Oct 30 '22 11:10

ischas