The MS SQL Server SqlGeography type represents data in a geodetic (round earth) coordinate system.
Questions tagged [sqlgeography]
264 questions
1
vote
2 answers
DataTable Value Mismatch Using SqlGeography and C#
So, the following code is giving me a rather confusing exception.
public void BuildTable()
{
using (SqlConnection connection = new SqlConnection("Data Source=ylkx1ic1so.database.windows.net;Initial Catalog=hackathon;Persist…

Pharylon
- 9,796
- 3
- 35
- 59
1
vote
1 answer
No mapping exists from object type System.Data.Spatial.DbGeography to a known managed provider native type
I am building an app using the DotNetNuke 7 platform and am trying to write Geography data to the database. Here is some background on the project. I am building in VS 2012 and just upgraded to Server 2012 from 2008 R2. DotNetNuke 7 implements…

Mark Hollas
- 1,107
- 1
- 16
- 44
1
vote
1 answer
SQL error while using MySQL geometry function
ALTER PROCEDURE dbo.StoredProcedure1
AS
DECLARE @Seedid int, @data1 float, @data2 float, @g geometry
DECLARE member_cursor CURSOR FOR
SELECT id from test1 ;
OPEN member_cursor;
FETCH NEXT FROM member_cursor
INTO @Seedid ;
WHILE…

PhantomM
- 825
- 6
- 17
- 34
1
vote
1 answer
SQL Timeout Geography Query
I Get a random/intermittent SQL timeout on this query looks like it generates a lot of processing from a simple query. Is this correct behavior?
I have a simple stored procedure like this:
CREATE PROCEDURE [dbo].[FindClosestXNearCoordinates]
…

ExtremeCoder123
- 13
- 3
1
vote
3 answers
One of the identified items was in an invalid format - Microsoft.SqlServer.Type
I'm trying to retrieve geography data from my SQl Server 2012 DB with:
new SqlDataAdapter("SELECT [SpatialColumn] FROM [SpatialTable]", myConnection).Fill(myDatatable);
When the data is a Sql Server 2008 geography type such as Polygon, it's all…

Johann
- 12,158
- 11
- 62
- 89
1
vote
1 answer
Get position from geography column
I'm migrating a table containing geographic information as latitude, longitude, to one using a geography column (in SQL server 2008).
I need to update a stored procedure which returns those values.
I can do this:
DECLARE @geog geography;
SET @geog…

Melanie
- 1,349
- 2
- 17
- 27
0
votes
1 answer
When Using STUnion to construct a polygon, is it faster to do it on code or let the Database handle it?
I was just wondering which is faster:
Constructing a wkt polygon using SQLGeography's STUnion method.
Constructing a wkt polygon using the STUnion method built into MS SQL Server.
I only ask because I wanted to be sure. I'm assuming that if I…

avtoader
- 63
- 1
- 8
0
votes
2 answers
Extra clauses with a CTE and Geopgraphy datatype
I'm creating a query to match based on distance people using zip codes using the Geography datatype in SQL Server. I have it 99% there, but I have two problems. At the moment, this searches by zip, city and state, but I also need to match on…

Echilon
- 10,064
- 33
- 131
- 217
0
votes
1 answer
Using NetTopologySuite, how can I convert meters to degrees?
I have no language preference for an answer; either VB.NET or C# will be fine.
I've seen this problem discussed elsewhere here on SO, for example here and here, but I've not found solutions that employ the NetToplogySuite and ProjNet libraries.…

InteXX
- 6,135
- 6
- 43
- 80
0
votes
1 answer
Error on loading SQL geography type column into Vertica
I was trying to convert latitude and longitude columns which is in float type to geography type in SQL and then load them into Vertica table.
I used the following code to convert the columns into geography type:
CASE WHEN (Latitude IS NOT NULL AND…
0
votes
1 answer
How to find distance from one geographic co-ordinate point to nearest polygon
I want to find the closest distance from one co-ordinate to the nearest end of a region.
Like the image below, how can I calculate the closest distance from red dot to end of the region polygon?
So basically the distance of red line.
I used…

jjun
- 3
- 1
0
votes
1 answer
Cross-platform solution to do geography calculations
I'm working on migrating a .Net framework application to .Net Core and I need to support running on Linux.
The application needs to calculate the intersection of polygons and very long lines on the Earths surface, and so it uses Geography objects as…

Q-bertsuit
- 3,223
- 6
- 30
- 55
0
votes
1 answer
Azure Data Factory Copy Pipeline with Geography Data Type
I am trying to get a geography data type from a production DB to another DB on a nightly occurrence. I really wanted to leverage upsert as the write activity, but it seems that geography is not supported with this method. I was reading a similar…

hunterjacob
- 3
- 2
0
votes
0 answers
Find Minimum Distance Between Sets of Geography Data Points
I am using SSMS for SQL Server Express 2019.
I am trying to find a way to classify a set of geographic locations by comparing their distance to a set of reference points.
Table A includes a column of location names Name and a column of geography…

Matt
- 1
0
votes
0 answers
Running STGeomFromText from within access gives "Syntax Error (Missing Operator) in query expression"?
The following code runs on a button on a form that I click and every time the button is clicked it stops at the recordset line with:
Syntax Error (Missing Operator) in query expression
'geography::STGeomFromText('POINT(-95.3098 29.8131)', 4326)'
I…

ouch
- 31
- 3