Spatial

Entity Framework: SqlGeography vs DbGeography

让人想犯罪 __ 提交于 2019-11-30 07:29:12
问题 What is the difference, or intended purpose of these two object that represent the same Geography datatype in a Microsoft SQL Database? System.Data.Entity.Spatial.DbGeography and Microsoft.SqlServer.Types.SqlGeography They can't be cast between each other, but SqlGeography has additional command when it comes to creating points, polygons etc. I'm thinking that System.Data.Entity is for use with Entity Framework only, whilst Microsoft.SqlServer is for use when using the SqlCommand directly

How to Import shape file into MySQL

烈酒焚心 提交于 2019-11-30 07:18:24
I need to import the spatial data in shape file into MySQL tables. I am able to import into PostGreSQL. Any pointers for MySQL. I need the data in MySQL table. try this whit FWtool instaled ogr2ogr -f MySQL MySQL:database_name,host=localhost,user=root,password=1234 C:\route_path\line.shp -nln datatable_name -update -overwrite -lco engine=MYISAM try install for better result in any proces Osgeo4w http://trac.osgeo.org/osgeo4w/ I have just used the ogr2ogr command line tool to import the shape file into the mysql database. Make sure that the database server allows external connections. If doesn

SQL Server - stored procedure suddenly become slow

安稳与你 提交于 2019-11-30 05:04:29
问题 I have written a stored procedure that, yesterday, typically completed in under a second. Today, it takes about 18 seconds. I ran into the problem yesterday as well, and it seemed to be solved by DROPing and re-CREATEing the stored procedure. Today, that trick doesn't appear to be working. :( Interestingly, if I copy the body of the stored procedure and execute it as a straightforward query it completes quickly. It seems to be the fact that it's a stored procedure that's slowing it down...!

JSON.Net JsonConverter for DbGeography

大城市里の小女人 提交于 2019-11-30 04:13:27
Long long struggles with this... Basically I have a model-first EF5 object with a DbGeography property. I would like to apply a JsonConverter that let's it roundtrip as simple latitude/longitude values. I'm using WebAPI. Looking for JSON output and input like so: { "location": { "geopoint": { "latitude":40.770712, "longitude":-73.962011 } } } Here is my class definition and JsonConverter: [MetadataType(typeof(QueryLocationMetadata))] partial class Location { } public class QueryLocationMetadata { [JsonConverter(typeof(DbGeographyConverter))] public virtual DbGeography GeoPoint { get; set; } }

How to create spatial index using EF 6.1 fluent API

我的未来我决定 提交于 2019-11-30 03:38:49
问题 Well, the question is clear enough. Is it possible to create spatial indexes using Entity Framework 6.1 fluent API? 回答1: Short answer- No, it is not. I have seen this tangentially referenced throughout blogs and have found no concrete examples of implementation. It seems to be related to the fact that spatial indexes are filtered indexes, which are not supported in Entity Framework. As support for my answer I constructed a POC console app with the most recent version of Entity Framework (6.1)

Best Performance-Critical Algorithm for Solving Nearest Neighbor

雨燕双飞 提交于 2019-11-30 02:29:37
We have a list of x,y pairs. Every pair represents a point on a 2D space. I want to find the closest point from this list, to a specific point xq,yq. What is the best performance-critical algorithm for this problem? Lisp of points is not going to change; which means I do not need to perform insertion and deletion. I want just to find the nearest neighbor of a target xq,yq point in this set. Edit 1: Thanks to all! As Stephan202 has guessed correctly, I want to do this repeatedly; like a function. An the list is not necessarily sorted (In fact I do not understand how can it be sorted? Like a

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

孤街醉人 提交于 2019-11-30 02:15:19
问题 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

Selecting a good SQL Server 2008 spatial index with large polygons

走远了吗. 提交于 2019-11-30 00:38:18
I'm having some fun trying to pick a decent SQL Server 2008 spatial index setup for a data set I am dealing with. The dataset is polygons, representing contours over the whole globe. There are 106,000 rows in the table, the polygons are stored in a geometry field. The issue I have is that many of the polygons cover a large portion of the globe. This seems to make it very hard to get a spatial index that will eliminate many rows in the primary filter. For example, look at the following query: SELECT "ID","CODE","geom".STAsBinary() as "geom" FROM "dbo"."ContA" WHERE "geom".Filter( geometry:

How can I speed up this Sql Server Spatial query? [closed]

别等时光非礼了梦想. 提交于 2019-11-29 23:22:10
I have (what I think) is a simple Sql Server spatial query: Grab all the USA States that exist inside some 4 sided polygon (ie. the viewport/bounding box of a web page's google/bing map) SELECT CAST(2 AS TINYINT) AS LocationType, a.Name AS FullName, StateId, a.Name, Boundary.STAsText() AS Boundary, CentrePoint.STAsText() AS CentrePoint FROM [dbo].[States] a WHERE @BoundingBox.STIntersects(a.Boundary) = 1 It takes 6 seconds to run :( Here's the execution plan.... Removed And the stats on the Filter operation... Removed Now, I'm just not sure how to debug this .. to figure out what I need to

Migrate SPATIAL data from Oracle to Postgresql

为君一笑 提交于 2019-11-29 22:46:03
问题 I am trying my best to migrate a spatial database from Oracle to Postgresql and failing miserably. I have tried many different avenues as you can see from my previous question on here and none are working. Can someone please tell me of a relatively painless way of doing this as I am now clueless with it. I have tried using 3rd party software such as SwisSQL but this failed with a multitude of errors. I have tried creating files full of insert statements and then creating a C# program to parse