The MS SQL Server SqlGeography type represents data in a geodetic (round earth) coordinate system.
Questions tagged [sqlgeography]
264 questions
0
votes
1 answer
How can I add a distance in meters to the latitude value in SQL Server 2014
Given
DECLARE @p1 geography
DECLARE @p2 geography
DECLARE @distance int
SET @distance = 10000 -- meters
SET @p1 = geography::Point(51.5001524, -0.1262362, 4326)
How can I set @p2 such that its latitude is @distance meters north or south of @p1?

Tom Elmore
- 1,980
- 15
- 20
0
votes
1 answer
Issue with SQLGeography STUnion & inner rings for drawing polygons on Bing Maps WPF control
I am writing an app using Bing API Spatial Data services to take of list of zip codes and combine them into one region. I have it mostly working but it seems to have issues with inner rings. Instead of a) deeming the inner region too small and…

Hershizer33
- 1,206
- 2
- 23
- 46
0
votes
1 answer
Check if DbGeography Point is on a line
I am searching for a method or algorithm similar to DbGeography.Intersects(). This method compares two lines and returns true, if they cross each other. If they don't touch each other, or one line ends directly on the other line, it returns false.…

jasdefer
- 757
- 12
- 24
0
votes
0 answers
Microsoft System CLR Types for SQL Server2012
I use the Dbgeography type found in using System.Data.Spatial to do some work on polygons in C#.I save the polygons as text in sql server 2008 r2 becuase I use Peta Poco for data access (which i really like).Is there anyway I can develop an app in…

Paul Stanley
- 1,999
- 1
- 22
- 60
0
votes
0 answers
Insert data for geography data type in array php
I have problem inserting geographic data into sqlserver database. This is my array:
this is my controller
UPDATED
function add()
{
$Code = $this->input->post('Code');
$Description = $this->input->post('Description');
$Data=…

farahdalilah
- 9
- 4
0
votes
1 answer
SQL Server; STDistance function not working in update statements
I have a table like this
EventTable (IsFar bit, Location geography)
No Problem with Select statement:
I can simply run this with no error:
DECLARE @center AS GEOGRAPHY = GEOGRAPHY::Point(50, -160, 4326);
SELECT * FROM EventTable WHERE …

Hossein Narimani Rad
- 31,361
- 18
- 86
- 116
0
votes
2 answers
How can I tell SQL Server to treat large polygons properly?
I'd like to represent a large square as a polygon in a SQL Server database. This polygon spans almost the entire map.
Here are the boundary co-ordinates (latitude, longitude)
North-East Corner: { 83.4871233224387, 63.5599894667969 }
South-West…

Mansfield
- 14,445
- 18
- 76
- 112
0
votes
2 answers
Elementary SQL STDistance Implementation?
I know that with SELECT @source.STDistance(@target)I can derive the distance between two spatial objects, and more complex with something like this, where I can wrap up nearest neighbor in a trigger and get values from nearest neighbor. I'm afraid I…

tpcolson
- 716
- 1
- 11
- 27
0
votes
1 answer
SQL Server Geography Query works but Geometry Query Does Not - Different Tables, Similar Schemas
I am trying to get a Geometry query to work. A similar Geography query works fine but I must work with a table that uses a Geometry type. Although the Geography version returns lots of records as expected, I cannot get the Geometry version to return…

ChrisCurrie
- 1,589
- 6
- 15
- 36
0
votes
2 answers
SQL DBGeography second insert fails
This one is a strange one. I am trying to save a polygon from Google maps into MS SQL, via an MVC controller. The problem is that the first time I do it, it works, the second time it gives me the error:
The incoming tabular data stream (TDS) remote…

Dominik
- 1,366
- 2
- 18
- 37
0
votes
1 answer
SQL Spatial number of times a Linestring intersects other Linestrings
So, I have a table named "lines" that has a field named "WKT" with the corresponding geography.
I builded a query that gives me the name of the line that was intersected, like this:
DECLARE @DF GEOGRAPHY
Set…

Pete Yorn
- 3
- 2
0
votes
1 answer
Verify a lat/long coordinate is in a SQL spatial table on geography column
We have a spatial table (dbo.Map) with eleven polygons representing eleven regions. This table has unique IDs, names, and other meta data associated with it, as well as a geography data-type column called geo. We also have a separate table…

MatthewHoza
- 1
- 2
0
votes
1 answer
STDistance – Calculates distance between two objects
I try to calculate the distance between two objects.
declare @p1 geography
declare @p2 geography
SELECT @p1 = WKT from tbl_1 where loc = "school"
SELECT @p2 = WKT from tbl_2 where loc = "school"
select round(@p1.STDistance(@p2)/1000,0)…

John Doe
- 9,843
- 13
- 42
- 73
0
votes
2 answers
TSQL Geography Spatial Data Polygon Lat/Long Search
TSQL SQL Server 2008 r2
Is it possible to store a Polygon consisting of Latitudes and Longitudes and then perform a search within that Polygon to see whether given a given Latitude/Longitude exists within that Polygon?
If so, how does one go about…

Mazhar
- 3,797
- 1
- 12
- 29
0
votes
1 answer
Polygon in geograhy doesn't work
I am trying to create a polygon in a geography datatype in SQL Azure but It keep getting me an error that the specified input doesn't represent a valid geography instance ALTHOUGH when I change the datatype from geograhy to geometry it works fine.
I…

Mohamed Naguib
- 1,720
- 6
- 23
- 32