The MS SQL Server SqlGeography type represents data in a geodetic (round earth) coordinate system.
Questions tagged [sqlgeography]
264 questions
0
votes
1 answer
Scale a SQL geography polygon
Is it possible to scale a SQL geography polygon like what is being done here?
Ideally I'd like to add a buffer of x meters either to the inside or outside of the original geography in SQL.
I also have DotSpatial and R available if a SQL option is…

jhhwilliams
- 2,297
- 1
- 22
- 26
0
votes
0 answers
Need invalid SqlGeography to test MakeValid
I need it for the unit test of MakeValid method. All I can find, is invalid text, which is not getting converted to the SqlGeography.
So I need to create invalid SqlGeograpy object somehow.
using System.Data.SqlTypes; //use Nuget…

sam sergiy klok
- 526
- 7
- 17
0
votes
2 answers
Get all Longitude and Latitude within a radius without spatial type Entity Framework
We have a postal code table with longitude & latitude as column, can't be changed to spatial data type due to production requirement.
Was using STDistance() but I'm getting an error:
LINQ to Entities does not recognize the method
Therefore I have…

AppeShopper
- 265
- 1
- 2
- 11
0
votes
2 answers
Calculating distance with latitude longitude pair in query
I have the following table in sqlfiddle
a b alat alon blat blon
A X 40 -76 26 -80
B Y 41 -74 24 -81
C Z 42 -73 24 -80
I would like to use a select query to add a numeric distance…

Alex
- 2,603
- 4
- 40
- 73
0
votes
0 answers
Append polygon into multipolygon
Currently, when I save a multipolygon, I do this by combining all the polygons I have into one string before I save them into one cell. Worked like a charm so far.
However, I'm starting to get bigger and more polygons, which creates huge strings and…

noClue
- 958
- 1
- 13
- 34
0
votes
1 answer
SQL Server geography latitude longitude error
I'm using geography data type for calculating shortest distance.
CREATE TABLE Landmark (
Id int,
Latitude FLOAT,
Longitude FLOAT
)
INSERT Landmark VALUES
(1, 49.242458, -123.153465),
(2, 49.249381, -122.866683)
WITH…

bbusdriver
- 1,577
- 3
- 26
- 58
0
votes
1 answer
Using linq to find out the nearest data with the given latitude and longitude
I have a data table which stores has data stored as per latitude and longitude.
I need to use LINQ query to filter in this datable and find the nearest location from the given latitude and longitude.
For example:
28.9873 -- Latitude,
80.1652 --…

Ayam Pant
- 83
- 3
- 8
0
votes
2 answers
SQL WKT draws well with geometry, but not with geography data type
I have a following piece of code
DECLARE @g geometry;
DECLARE @borders geography;
SET @g = geometry::STGeomFromText('SOME WKT', 0);
SET @borders = GEOGRAPHY::STGeomFromText(@g.MakeValid().STAsText(),4326)
SELECT @g;
SELECT @borders;
Since it's…

Robert
- 3,353
- 4
- 32
- 50
0
votes
0 answers
Choosing the correct datatype for storing locations
I am trying to figure out how I should store location data in a database.
Some articles I read recommend using the geography data type and others recommend geometry.
I would like to know what the difference is and why do both seem to require more…

Piet Hein
- 184
- 2
- 16
0
votes
0 answers
How can I increase select query on table with 60gb
I have a table with about 60gb and with these columns:
ColumnA: type: Int
ColumnB: type: Int
ColumnC: type: Real
ColumnD: type: Real
ColumnE: type: Real
ColumnF: type: Real
ColumnG: type: Real
I have an index [ColunaA, ColunaB]
I have a laptop with…

Joao Rafael
- 11
- 5
0
votes
1 answer
SQL Server / C# How to find the DateTime a Linestring Intersected a Polygon
I am building a tracking system and want to find when someone has entered or left an area (Zone or Tier). We are collecting GPS coordinates at 5 sec intervals and they are stored as both lat/long and in a geography column along with the reading…

Joshua Engelbrecht
- 185
- 1
- 2
- 9
0
votes
1 answer
MSSQL Spatial index multiple predicate not using the index
I have a Location table with a spatial index on the GeoLocation column. The following query works:
SELECT *
FROM Location WITH (INDEX (SpatialIndex_GeoLocation))
WHERE GeoLocation.STDistance(GEOGRAPHY::STGeomFromText('POINT(4.271942 …

David
- 51
- 1
- 7
0
votes
1 answer
Using the SQL Server Geography data type
I am working with a SQL Server database that has a customer table in it that contains (among other things) an address column. This column houses the full address (street, city, state, zip) as one long text string. We are looking to convert this…

BT_SO
- 25
- 1
- 3
0
votes
1 answer
Calculating the largest "inner" rectangular box inside a complex SQL geography shape
I'm trying to generate reports that involve overlapping geographical boundaries.
As a simplified example, zip codes inside a DMA (designated marketing area).
I have SQL geography data describing the polygon shape of the DMA, and SQL geography data…

Jake McGraw
- 135
- 4
- 11
0
votes
1 answer
SQL Server 2008 geography - spatial result - color based on another column value
I have a table like this in SQL Server 2008:
serv_type coords
------------------------
shop 0xE6100000010CE4857478080B49401CD2A8C0C9DE2C40
shop 0xE6100000010C54C6BFCFB80A49408A592F8672DA2C40
restaurant …

Helena
- 623
- 1
- 6
- 12