-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Spatial Data Types on SQL Server and SQLite #1100
Comments
@vijayantkatyal are you asking about EF Core? |
I have the same Question. I am trying to use the DbGeometry datatype, but it is unavailable with EF Core, neither System.Data.Entity.Spatial nor System.Data.Spatial are referable. |
Partially covered by #242 but we probably also want to look at built-in support for spatial types. |
@rowanmiller sorry for late response. yes i'm asking about EF Core. |
+100000. We make extensive use of spatial data in our applications. |
I know you guys aren't working on this at the moment, but what are the chances that you'll be reusing types and concepts from EF6's System.Data.Entity.Spatial namespace? I'm asking because there's some interest in working on this namespace and I'd like to have an idea (if possible) as to whether that will be useful going forward... cc @rossini-t |
@roji At the moment, I don't think we intend to put a common abstraction over it. Instead we would light-up provider-specific types like SqlGeography leveraging the work of #242. |
OK thanks. Note that this mean it will no longer be possible to write provider-independent code that manipulates spatial DB values (as was possible in EF6). I have no idea to what extent spatial support across databases (SqlServer, PostGIS, etc.) overlaps, so this may or may not be a big loss. Then again with the EF Core approach a common spatial abstraction seems to be a problem outside of EF's domain - as long as #242 allows for reading/writing the provider-specific spatial types a common abstraction may or may not be used afterwards. |
Any news about Spatial types in EF Core? |
I'd also love an update -- it's a blocker for EF Core, ASP.NET Core and .Net Core for us. Can't wait to try out the new toys though! |
Spatial data type support will happen post initial RTM of EF Core (i.e. after the 7.0.0 release). This is purely due to how much work we can achieve between now and RTM and not because we think this scenario is unimportant. |
Tks for answer @rowanmiller... |
it seems we have no way but waiting for next release of EF Core to include and support the Spatial types |
Just a vote for basic DbGeography support. Our application (like many others I am sure) relies on the DbGeography datatype mapping to the geography type in SQL Server. Very disappointing that an actual datatype, fully supported by EF6, would be de-prioritized for EF Core. There isn't even a mention of it in the roadmap. Please don't let this one slip through the cracks. |
So what can we do now to use spatial types from EF Core? |
Also a vote here for some DbGeography support! |
Speaking from a PostgreSQL perspective, if and when you do tackle the problem of spatial data it's extremely important to do so with a cross-provider vision. EF6's spatial types, just like most other things in EF6, were designed to work with SqlServer's spatial support and don't necessarily capture what PostgreSQL's PostGIS allows - so a provider-independent abstraction such as DbGeography may not work well here. Am far from being an expert here but it's important not to rush into this without comparing spatial support in different databases etc. |
Any Timeline to support DbGeography or DbGeometry? |
It is in the roadmap: https://github.com/aspnet/EntityFramework/wiki/Roadmap |
"High priority features" means "lowest priority" of the list? |
No way should an actual datatype, used by many existing EF6 applications, be lumped in with a bunch of wish-list items that impact nobody. |
@bricelam Extremely helpful, thank you! |
I still don't like that Location/Distance is ignored on the client. It doesn't make sense to me how to handle calculations across the US with these big string projections (2855 in your example) |
We too are eager to see this experience improved. We’ll continue working with the NTS team to try and improve the end-to-end spatial experience in EF Core. |
Something weird is going on here
polygon in extent - "POLYGON(( The polygon in memory - POLYGON(( The polygon actually passed to SQL Server (as varbinary) - POLYGON (( Notice all the Easting/Northing values are backwards - what's going on here? |
Is this because I've used geometry rather than geography? If so, how do you get NTS to send geometry compatible data? |
@lawrencephillips We'll need a full repro to investigate. Can you submit a new issue with more details? |
So in SQL server my coords are stored as Latitude and Longitude doubles. |
Why not store your coordinates as a geography point?
If you do then you can use spacial indexes.
Jonathan Allen
619-933-8527
…________________________________
From: John Waters <notifications@github.com>
Sent: Tuesday, February 12, 2019 7:33:46 AM
To: aspnet/EntityFrameworkCore
Cc: Jonathan Allen; Mention
Subject: Re: [aspnet/EntityFrameworkCore] Support Spatial Data Types on SQL Server and SQLite (#1100)
So in SQL server my coords are stored as Latitude and Longitude doubles.
What do I do to select records based on distance to a point in a ef core linq query? Is there some cast I can do in the DB query, or do I have to do a migration that converts my schema to use a spatial data type?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#1100 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AKIqTbnatHVcWMtNroa3Gm3jG6M47cckks5vMt7agaJpZM4C9f_8>.
|
I believe that the latest entity framework core has spatial data support.
This is an old issue. Try using Geography.
…On Tue, 12 Feb 2019, 16:33 John Waters ***@***.*** wrote:
So in SQL server my coords are stored as Latitude and Longitude doubles.
What do I do to select records based on distance to a point in a ef core
linq query? Is there some cast I can do in the DB query, or do I have to do
a migration that converts my schema to use a spatial data type?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1100 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGsfMyF-UrC_qe4LTOuJLapigH1Ax0fUks5vMt7ZgaJpZM4C9f_8>
.
|
@bricelam is this workaround with projecting still required in 2.2 or not anymore? |
@murbanowicz Yes. Documented here. We're working with the NTS folks to try and improve this in future versions. |
Which package should I be using now if I want to use ADO.NET with SqlGeography? Microsoft.SqlServer.Types is still supported only on .Net Framework. And all I see about spatial data on .Net Core is about EF. |
@andre-ss6 There is currently no official way to use SqlGeography on .NET Core. (You can hack it in various ways, or read the binary protocol like EF does, but you can't use the actual released types.) This code is owned by the SQL Server team, but from a .NET Core side the issue is being tracked by https://github.com/dotnet/corefx/issues/31775 |
@andre-ss6 you can try this re-implementation https://github.com/dotMorten/Microsoft.SqlServer.Types |
Cant find much documentation on how to use NetTopologySuite with Entity Core. Looking for stuff like Links to any documentation on CRUD operations using Enitity Core/NetTopologySuite will be great. |
@zp978 Does https://docs.microsoft.com/en-us/ef/core/modeling/spatial cover what you are looking for? |
Thanks for the reply. https://docs.microsoft.com/en-us/ef/core/modeling/spatial does not cover much, Was looking for examples of CRUD operations to geography type columns . Inserting a new row using (entity core/nettopologysuite) in DB with a Geography column type that will store a Polygon ? or Even inserting a new row in the DB with column (geography) storing location pount? Have also checked http://www.npgsql.org/efcore/mapping/nts.html not much info there either. |
@zp978 Thanks for your feedback. I moved your issue to the docs repo here: dotnet/EntityFramework.Docs#1471 |
Hi @bricelam I am trying to implement your example, but I get "The name 'GeometryTransform' does not exist in the current context". I have added the ProjNET4GeoAPI and Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite nuget package. Where does this 'GeometryTransform' come from? |
Nevermind I was missing the NetTopologySuite nuget package. |
@superdopey Re-opened dotnet/EntityFramework.Docs#1260 |
@mouaddjedidi The coordinate system 2855 is designed to give accurate results for the area around Redmond. See https://epsg.io/2855 (you can use that site to find a suitable coordinate system for Paris) |
I'm not missing it, but still getting this error |
@piatkiewicz can you please open a new issue with the full error and a runnable code sample? |
@roji sorry i'm not familiar with this topic and decided to other solution to my problem so removed code already, but all I did was copy-paste code above and install all what VS proposed. |
how to use Spatial Data types (e.g. DbGeography) in model (code-first method) to save points, shapes etc.
e.g.
public DbGeography gps_points {get; set;}
i'm unable to use "DbGeography".
The text was updated successfully, but these errors were encountered: