The SqlGeometry class in MSSQL Server API representing data in a Euclidean (flat) coordinate system.
Questions tagged [sqlgeometry]
68 questions
2
votes
0 answers
Geography and projection in .NET Core
I'm looking for an alternative to SqlServer.Types capabilities for .NET Core.
I need methods like Buffer(), Intersects(), Distance() using both geography (on spherical Earth) and geometry objects.
Furthermore, I need to project these objects from/to…

Lodeli
- 43
- 6
2
votes
0 answers
Out of memory exception while the build of a GPS trace containing a lot of GPS data
I obtain GPS points of a vehicle in order to build its trace.
I develop in C# and use the SqlGeography type (LineString). I store it into a SQL Server database by using the geography type.
Each received GPS point is added with the AddLine method…

profou
- 197
- 1
- 17
2
votes
1 answer
Geometry error on one server but not the other with same data
I have a table with approx 400 rows of geographic data and I'm using the STWithin method to determine if a point exists within the boundary of one of those rows.
On my test server it works fine. However with the latest version of the dataset the…

Danny S
- 403
- 4
- 12
2
votes
3 answers
How to compare geometry in SQL Server?
I am using SQL Server 2012.
I have this column of type geometry in my table:
POINT (34.8780917279395 32.1872894246816)
In another table I also have a column of type geometry:
0xE6100000010CB3314B4F6570414073F29019F9174040
How can I compare these…

Michael
- 13,950
- 57
- 145
- 288
2
votes
1 answer
Latitude and longitude values from sqlgeometry linestring using C#
I recently discovered spatial columns in Microsoft SQL.
I have now successfully stored LINESTRING sqlgeometry with correct EPSG (STRID). Checked by using AutoCAD Map.
The data is now sqlgeometry LINESTRINGs containing groups of X Y…

Kevin Barnett
- 35
- 2
2
votes
1 answer
How to speed up conversion of lat-long to a SqlGeometry?
I have this code, it takes the geometry of countries and also a set of points, and then it only returns the points within those countries :
public static IEnumerable RemovePointsOutsideBorders(IEnumerable points, IEnumerable…

sprocket12
- 5,368
- 18
- 64
- 133
2
votes
0 answers
SqlGeometry parameter error in DataTable translated to TVP
I am trying to pass in a TVP datatable containing geometric polygons. For some reason, my geometry objects are being rejected before the query is even run with the following error: System.ArgumentException: The type of column 'Coordinates' is not…

Kevin Walter
- 21
- 1
2
votes
0 answers
Entity Framework equivalent of `geometry::UnionAggregate` (SQL Server 2012)
Is there an Entity Framework equivalent of this query, mentioned here?
SELECT geometry::UnionAggregate(geomcolumn) FROM YourTable;
The goal after that being to use it in a GROUP BY, such as...
SELECT geometry::UnionAggregate(geomcolumn)
FROM…

jocull
- 20,008
- 22
- 105
- 149
2
votes
1 answer
Why would STContains return null?
Why would SQLGeometry.STContains return null when the values being used are not null?

Jonathan Allen
- 68,373
- 70
- 259
- 447
2
votes
1 answer
How to control JSON.NET serialization of System.Data.Spatial.DbGeometry
I have a DB First Entity Framework 5 Data Access Layer that is mapped to a table containing a SQL geometry type field called CenterCoordinate. The resulting entity contains this:
public System.Data.Spatial.DbGeometry CenterCoordinate { get; set;…

MattPil29
- 185
- 1
- 11
1
vote
1 answer
SQL : Select longest and unique route
I have a table that contains the route's GPS traces and I want to select only unique and longest routes.
Table looks like:
route_id gpstrace
route1 [[long,lat], [long,lat],... ]
route2 [[long,lat], [long,lat],... ]
route3 …

L Lawliet
- 419
- 1
- 7
- 20
1
vote
1 answer
SQL Select valid Geometries without using MakeValid
I have a large table of data with SQLGeometry values in it. Many of the rows contain "not-well-formed" Geometries according to OGC (Geometry.STIsValid()). This causes many of my Geometries to throw an error when I check the…

Kyle B
- 2,328
- 1
- 23
- 39
1
vote
1 answer
Divide table into chunks with table data to process them in SQL Server
I hope you guys can help me or at least point me in the right direction. I have a SQL Server table that represent the boundaries of a Polygon. It roughly looks like this in a simplified…

l_degaray
- 63
- 9
1
vote
1 answer
SqlGeometry in Entity Framework Core
I'm trying to work with Entity Framework Core against a SQL Server database.
I've got a test class (based on Microsoft's demo 'blog/post' sample code) which I migrate to a SQL Server database.
I want to add a member to my test class which will save…

Dave Alger
- 339
- 7
- 23
1
vote
0 answers
sql query Polygon of Points in MSSQL
Below query successfully executes in MySQL but throwing an error in MSSQL as equivalent functions may not exist.
Can anybody provide me an example to equivalent query in MSSQL 2012 ?
CREATE TABLE geo_tmp
( startIp varchar(12) NOT NULL,
endIp…

Krishna
- 11
- 3