The MS SQL Server SqlGeography type represents data in a geodetic (round earth) coordinate system.
Questions tagged [sqlgeography]
264 questions
0
votes
0 answers
SQL Geography: Cannot add features outside of -90, 90 degree limit?
With the following spatial constraint:
ALTER TABLE [dbo].[TRANS_TRAILS_LN] WITH CHECK ADD CONSTRAINT [g10_ck] CHECK (([SHAPE].[STSrid]=(4269)))
GO
ALTER TABLE [dbo].[TRANS_TRAILS_LN] CHECK CONSTRAINT [g10_ck]
GO
and index:
CREATE SPATIAL INDEX…

tpcolson
- 716
- 1
- 11
- 27
0
votes
0 answers
How to remove duplicates in spatial database?
I don't have much experience in work with Spatial Database and want to ask, how can I check for doublets in spatial DB ?
Is it possible to do it with SQL? How to check polygons geometry?

user3486513
- 29
- 1
- 5
0
votes
1 answer
Return the list of points inside a rectangle
I've a database (MySQL) of geographic (lat, long) points and I need to query a list of points from one rectangle (which have 2 coordinates for each vertex).
Is there any query or algorithm to resolve this problem fast.
Thanks.

Fabrizio A
- 3,072
- 5
- 24
- 35
0
votes
1 answer
Generate view with X and Y from geometry type
In sql-server-2012 I want to generate view with all points from geometry type. How can I do this?
View example
GeomKey | X | Y
--------+----+-----
1 | X1 | Y1
1 | x2 | Y2
2 | x1 | Y1
Example in Oracle with sys.SDO
select…

user3752907
- 11
0
votes
2 answers
How to return more than one field using a STIntersection query in SQL Server
I am calculating polygon intersections within SQL Server and have a table as shown below based on the example here: http://msdn.microsoft.com/en-gb/library/cc280766.aspx where 'Coordinates_OGC_WKT' is…

ChrisCurrie
- 1,589
- 6
- 15
- 36
0
votes
1 answer
Distances between multiple geography values
We used the average of multiple geography points to get the average and assign that as an items location.
I now need to trace through this data and somehow identify any of the original points which is too far away from the rest.
I reckon I'll need…

KrustyGString
- 903
- 2
- 13
- 32
0
votes
2 answers
Cannot map SQL Geography column to EF DbGeography class with dapper
I have table with sql geography column in my SQL database. I have generated entities for my database with EF6. As you know Entitiy Framework generates System.Data.Entity.Spatial.DbGeography for SQL Geography type. I'm using dapper to run queries and…

Mike
- 3,766
- 3
- 18
- 32
0
votes
1 answer
How to find the shortest distance of a point outside of a polygon starting at the polygon's edge?
Consider the following:
Point A DbGeography (office address)
Point B DbGeography (customer's address outside of office's service area)
Polygon C DbGeography (office's service area)
Using the above points and polygon, how can I find the closest…

Gup3rSuR4c
- 9,145
- 10
- 68
- 126
0
votes
2 answers
Checking if a Point is inside a Polygon not working
Using SQL Server 2012 the following query keeps telling me that the point I'm looking for is not inside the polygon I'm using, when I know it is. Using the same data in QGIS 2.2.0, I clearly see the point is inside the polygon (screenshot).
DECLARE…

Gup3rSuR4c
- 9,145
- 10
- 68
- 126
0
votes
1 answer
How can I create and calculate distance table using location table?
I have a TruckLocation table in SQL.
Select top 4 *
from TruckLocation
order by ReadTime desc
Result:
OID TruckID Lat Lng Speed ReadTime
123 33 37.4060 37.1470 58 2013-11-26…

Mhmt
- 759
- 3
- 22
- 45
0
votes
1 answer
Geography Select Query
I have a SQL Server 2012 location table, which has a column geo of type geography
I have a user table which links to the location table
location
locationId int
geo geography
user
userId int
locationId int
I will know the id of the location and I…

Dale Fraser
- 4,623
- 7
- 39
- 76
0
votes
1 answer
SQL Server Geography type performance - Data trigger vs. Views
I am trying to use sys.geography type in SQL Server 2008 R2. I want to use this geograpy type for location based queries. For example, I pass in a location (as longitude and latitude variables) to a stored procedure and return any records nearby.…

John
- 1,286
- 2
- 14
- 22
0
votes
1 answer
Convert SQL Geography to SQL Geometry or otherwise improve lookup speed
THE NEED: I am looking for a SQL statement to convert content of SQL Geography field of a table to SQL Geometry field type, new table field I am going to add to existent table. Or a better solution, hence the post.
REASON: I am looking to speed up…

san_sani4
- 1
- 2
0
votes
3 answers
How come this geometry point does not intersect with the polygon?
How come this geometry point does not intersect with the polygon? I know for a fact that the point exists in the given polygon. Any reason why it returns 0?
DECLARE @point geometry
DECLARE @poly geometry
SET @point =…

moussaleen
- 31
- 2
0
votes
1 answer
Efficiently finding the distance between 2 lat/longs in SQL
I'm working with billions of rows of data, and each row has an associated start latitude/longitude, and end latitude/longitude. I need to calculate the distance between each start/end point - but it is taking an extremely long time.
I really need to…

iambalrog
- 3
- 1