The MS SQL Server SqlGeography type represents data in a geodetic (round earth) coordinate system.
Questions tagged [sqlgeography]
264 questions
0
votes
0 answers
Create geography polyline(s) from points for many features in same table in T-SQL
A similar question has been asked here:
Create geography polyline from points in T-SQL
I have a table schema that looks like this:
CREATE TABLE [dbo].[LongAndLats](
[Longitude] [float] NULL,
[Latitude] [float] NULL,
[SortOrder] [bigint]…

user3799279
- 143
- 1
- 11
0
votes
2 answers
SQL geography how to get most Northern/E/S/W/highest/lowest?
The geography data type is new to me and I'm trying to get my head around how to use it. I have a simple question I'm unable to find an answer for.
I have a database containing coordinates (Lat, Lon; decimal(9,6)) and elevation (smallint) data.…

mindcopy
- 1
0
votes
1 answer
Latitude out of bounds
I get following exception when using Entity Framework to get data from bounds from a google map:
FormatException: 24201: Latitude values must be between -90 and 90 degrees.
POLYGON((81.9882716924738 140.187434563007,21.5587046599696…

Thomas Segato
- 4,567
- 11
- 55
- 104
0
votes
2 answers
SQL Server 2016 How can I map latitude and longitude to an address matching on latitude and longitude if the coordinates vary slightly?
I have 2 latitude and longitude set that are very close in proximity. How can I have SQL Server 2016 consider them the same address?
35.555925 -97.677617
35.55595 -97.677454

Irisheyes169
- 1
- 1
0
votes
1 answer
SQL Geography point STDistance ~25-50% off from Google?
I'm trying to do some very basic distance calculations using STDistance from one Geography Point to another. It works, but I am getting slight differences in the results from what google tells me when calculating the straight line distance.
Here's…

bech
- 627
- 5
- 22
0
votes
1 answer
Using a multiple select in a Linq-to-SQL expression
I need to call a model + object in my table in view .. how can I add the variable TotalTime and insert it in my table?
This is my code :
schoolinfo az = new schoolinfo();
var durer = 3;
var EstimationPrep = 20;
var TotalTime = durer *…

oussama_tr
- 61
- 7
0
votes
1 answer
SQL Geography Datatype , checking Point in Polygon , STIntersects producing wrong result
I am trying to check point in polygon, but STIntersect producing wrong result, below is given both point and polygon.
DECLARE @point GEOGRAPHY = GEOGRAPHY::Point(25.631119, 54.666181, 4326)
DECLARE @polygon GEOGRAPHY =…

Kashif Ali
- 35
- 1
- 1
- 7
0
votes
1 answer
Optimising bounding box query
I have a table for GeocodedPoints. This query that I am optimizing tries to pull out matching points for a lat-long location. Unfortunately it's too slow!
The table is essentially a list of bounding boxes and a corresponding address. It also…

Chris
- 26,744
- 48
- 193
- 345
0
votes
0 answers
Geography points matching
I have a data source with multiple co-ordinates (can range from 1 to 10000) in one MS SQL DB whose radius can vary dynamically based on the users selection (Source A). Based on the all these co-ordinates I need to find intersecting co-ordinates…

P. Sharma
- 71
- 5
0
votes
1 answer
Using EnvelopeCenter on a Geography variable is not returning the correct value in SQL Server
I have an SQL query where I declare two Geography variables, and then I'm trying to find the center point of the polygons after values are assigned to those variables.
This is my code:
DECLARE @g1 GEOGRAPHY;
DECLARE @g2 GEOGRAPHY;
SET @g1 =…

Raj
- 315
- 4
- 15
0
votes
0 answers
Filter out invalid geographies in an update statement
I'm trying to add a column to a table that contains a lot of geography shapes. The column is going to contain the shape's area. I first altered the table as follows:
ALTER TABLE geographyShapes ADD shapeArea FLOAT NULL;
Then I ran this update…

starx207
- 357
- 3
- 20
0
votes
2 answers
Geography Data Import
I'm trying to import geography data from a CSV file in to SQL server using the bcp (bulk copy tool) but I can't figure out the format. I would like to use something like this in the CSV files but I get errors on the POINT…

user1346563
- 65
- 7
0
votes
1 answer
Bad spatial query performance in SQL Azure (local DB is good)
I have a B-level SQL Azure DB, querying mostly using STIntersect based on minimal polygons (5 points), and had horrible performance issues. Checking for intersection on a 50K rows table took nearly a minute (spatial indices being in place and hinted…

Philipp Sumi
- 917
- 8
- 20
0
votes
1 answer
Why is MS Geography complaining about this polygon?
I am attempting to convert some coordinates into a geography object. Below is a simple test harness duplicating the problem.
Due to MS Geography requiring the coordinates in counter-clockwise, and my having no idea what the geozones I have are in,…

Hecatonchires
- 1,009
- 4
- 13
- 42
0
votes
1 answer
Pulling SQL Server GEOGRAPHY to POLYGONS
I have this query
SELECT
' {"location":"'+ G.ZCTA5CE10 +', ' + INTPTLON10 + ', ' + INTPTLAT10 + '",'+
'"polygon":' +
replace(replace(replace(replace(replace(replace(replace(G.geom.ToString(), 'POLYGON ((',…

arcee123
- 101
- 9
- 41
- 118