The MS SQL Server SqlGeography type represents data in a geodetic (round earth) coordinate system.
Questions tagged [sqlgeography]
264 questions
8
votes
3 answers
LINQ to SQL Designer and the Geography datatype
I am having a few problems loading a table into the designer.
I get the following error.
One or more selected items contain a data type that is not supported by the designer
Would I be correct in assuming it is the geography type used in the table…

Chin
- 12,582
- 38
- 102
- 152
7
votes
4 answers
How to correct Polygon Ring Orientation using C# Entity Framework 5 DbGeography Spatial Data
I'm working with the new Entity-Framework 5 using the Spatial data type DbGeography as part of my model for storing in one instance, a POINT and in another instance a POLYGON.
When setting the value of my POLYGON all saves with no error however this…

cronline
- 141
- 2
- 4
6
votes
2 answers
Spatial index slowing down query
Background
I have a table that contains POLYGONS/MULTIPOLYGONS which represent customer territories:
The table contains roughly 8,000 rows
Approximately 90% of the polygons are circles
The remainder of the polygons represent one or more states,…

David Budiac
- 811
- 2
- 9
- 21
6
votes
3 answers
Geospatial data in SQL
I have been experimenting with geography datatype lately and just love it. But I can't decide should i convert from my current schema, that stores latitude and longitude in two separate numeric(9,5) fields to geography type. I have calculated the…

Dimitri
- 6,923
- 4
- 35
- 49
6
votes
0 answers
SQL Server Geography datatype with .Net Core 2.1
I understand that the SQL Server geography and geometry datatypes are not currently supported in .Net EF Core, but I'd still like to use them in standard .Net Core 2.1. The Microsoft.SqlServer.Types package does not seem to work in Core, at least…

Connie DeCinko
- 802
- 2
- 15
- 32
6
votes
1 answer
SQL Server - Mismatch in column datatype and tessellation scheme
I'm trying to create an index on my Location column in the DB.
Receiving this error: Mismatch in column datatype and tessellation scheme
It's a simple Geography computed field of a Latitude and Longitude field.
[Location] AS…

aherrick
- 19,799
- 33
- 112
- 188
6
votes
1 answer
DB geography type MakeValid does not seem to be working
I have an application where the user draws zones and later I check if a polyline crosses them.
All of a sudden the application crashed out with the error:
A .NET Framework error occurred during execution of user-defined routine or aggregate…

ChrisCurrie
- 1,589
- 6
- 15
- 36
6
votes
2 answers
SQL Server STIntersects Query Returns false positives
The problem
STIntersects is returning false positives
The scenario
I draw a polygon representing a “London Congestion Charge” zone using GoogleMaps and save the coordinates to the database in a geography field
I get a polyline from Google…

ChrisCurrie
- 1,589
- 6
- 15
- 36
6
votes
3 answers
Is a point within a geographical radius - SQL Server 2008
Given the following data, would it be possible, and if so which would be the most efficient method of determining whether the location 'Shurdington' in the first table is contained within the given radius's of any of the locations in the second…

Nathan
- 285
- 1
- 4
- 10
5
votes
1 answer
Postgres / postgis - ensure all polygons are closed
I am needing to write a query which finds any unclosed polygons and closes them by copying the first point and creating an additional end point.
I am able to select the invalid rows:
SELECT delivery_zone_id, polygon from delivery_zone WHERE…

Ryan Wheale
- 26,022
- 8
- 76
- 96
5
votes
0 answers
Location clustering in SQL Server
I am working on displaying about 40,000 latitude longitude points on a map over Australia, I suspect most points are in towns but don't have data on the towns and would like to be able to cluster the points to get it to a size where I could put pins…

user802599
- 787
- 2
- 12
- 35
5
votes
2 answers
KML to SqlGeography
Anyone have a function or DLL that will convert KML to SqlGeography (SQLServer DataType)?
I'll write it out myself if i have to, but i'm surprised i can't find one out there.

capdragon
- 14,565
- 24
- 107
- 153
5
votes
1 answer
Minor inconsistency while calculating distance between two points
Consider the following function for calculating the distance between two points
CREATE FUNCTION CoordinateDistanceMiles(
@Latitude1 float,
@Longitude1 float,
@Latitude2 float,
@Longitude2 float
)
RETURNS float
AS
BEGIN
-- CONSTANTS
DECLARE…

MHOOS
- 5,146
- 11
- 39
- 74
5
votes
1 answer
Select records from a SQL Server database using geography and distance
I am using the SQL Server geography datatype to store the location of records in my database.
I would like to select all records within a given distance of a given location:
DECLARE @location AS geography = geography::Point(@latitude, @longitude,…

user3158212
- 555
- 6
- 16
5
votes
2 answers
Is there an implementation for SqlGeometryBuilder ?
Before the implementation of spatial types (System.Data.Spatial.DBGeometry) in the Entity Framework we could handle the lack of spatial support using "Microsoft.SqlServer.Types.SqlGeometry". This library has the class SqlGeometryBuilder which is use…

Laggel
- 1,356
- 3
- 19
- 36