The MS SQL Server SqlGeography type represents data in a geodetic (round earth) coordinate system.
Questions tagged [sqlgeography]
264 questions
4
votes
0 answers
Algorithm to detect similar polygons or SqlGeography objects
Does any one has better idea how to detect similar polygons or geographies using C# and SQL Server? Currently I am doing it by taking the STSymDifference (detects the points that do not lie in both of instances) of two SqlGeography objects and then…

Faheem Ramzan
- 45
- 5
4
votes
0 answers
Calculate square bounds on Earth with given radius for center point
I'm trying to calculate bounds for square with particular radius and when center of square is known(longitude, latitude). But I'm getting into troubles with it.
I've tried to use haversine formula from here :
But I'm getting into troubles when…

hades
- 1,077
- 3
- 11
- 19
4
votes
1 answer
sql server union on geography columns
I'm using sql server 2008 R2, and I have two tables, Regions and Facilities. Both have a column containing a geography element.
I want to calculate the union on the intersection of the geograpy elements, like this:
SELECT * from Regions join…

Melanie
- 1,349
- 2
- 17
- 27
4
votes
1 answer
Mapping SqlGeography using Entity Framework code first
I am playing around with Entity Framework 4 and the sqlgeography datatype. I am having trouble getting Entity Framework map my sqlgeography types to the db. I have defined my class as POCO and would like entity framework to create the tables for me.…

ThomasD
- 2,464
- 6
- 40
- 56
3
votes
1 answer
NHibernate pass Geography type to Named Query SetParameter()
I'm in the process of introducing NHibernate 3 into a data access layer for an ASP.NET MVC web application.
Within the SQL Server 2008 R2 database, a geography datatype is used to store lat/long coordinates in a table that maps to an entity within…

Russ Cam
- 124,184
- 33
- 204
- 266
3
votes
2 answers
'The specified input does not represent a valid geography instance' exception when using SqlGeographyBuilder
I've written a small application that reads in from a series of KML files and then converts them into the Microsoft.SqlServer.Types.SqlGeography type using the following code:
private SqlGeography CreateGeographyFromKML( string kml, bool debug…

Peter Bridger
- 9,123
- 14
- 57
- 89
3
votes
1 answer
Convert SQL Server Geography to PNG image
We have an API which converts MS SQL geography type to well-known text, and sends it to the front end, which then sends WKT to OpenLayer maps, which renders canvas (borders, regions etc).
I am looking a way to reduce payload to the client and…

Robert
- 3,353
- 4
- 32
- 50
3
votes
2 answers
org.postgresql.util.PGobject to org.postgis.Point;
Do you know how can convert the type of PGobject to Point in Java?
Actually PGobject is an object like this:
PGobject geolocation:
type: geography
value: 0101000020E6100000C006335CD3043840504BBDB89EC14140
How can convert this number into Point?

pik4
- 1,283
- 3
- 21
- 56
3
votes
0 answers
Cannot convert SqlGeography to SqlGeography
In f# I'm attempting create a SqlGeography type and save it to a record.
When SubmitChanges is called at runtime, it returns the following error message.
Also, I am using LinqPad if that matters.
InvalidCastException: Could not convert from type
…

mac10688
- 2,145
- 2
- 24
- 37
3
votes
0 answers
SQL Geography River Removal
How do you remove the 'holes'/linestrings/.etc from a GeographyCollection? Secondary, how do you join MPolygons that don't intersect into one polygon?
We have a roll up of zipcodes to a geographic map, but we have holes in the shape. Researched…

rusty
- 87
- 7
3
votes
3 answers
Update Geography column in table
I have the following table
As you can the Geo column (data type Geography) is null I currently have 11913 rows in this table what I'm trying to do is update the Geo column by using the following statement and populate the Geo column with the data…

Code Ratchet
- 5,758
- 18
- 77
- 141
3
votes
0 answers
Visual Studio Data Compare Bug when syncing 'Microsoft.SqlServer.Types.SqlGeography' types
An error is raised when attempting to run a script generated by Visual Studio's data compare tool. I could not find a solution though Google search.
This happens on all dev machines I have attempted it on in the office.
I am executing it from…

Microsoft Developer
- 1,919
- 1
- 20
- 27
3
votes
1 answer
SqlGeography.STIntersection() returns even when I know there is no intersection
A little about the application;
The application allows the user to draw and save polygons onto bing maps WPF api.
The piece of code we are interested in is finding weather a point is whithin the polygon or not. The following function simply loops…

clamchoda
- 4,411
- 2
- 36
- 74
3
votes
3 answers
.NET Equivalent of SQL Server STDistance
I can use the following SQL to calculate the distance between a fixed location and the location against the venues in the database.
SELECT Location.STDistance(geography::Point(51, -2, 4326)) * 0.00062137119 FROM Venues
Please note the distance…

nfplee
- 7,643
- 12
- 63
- 124
3
votes
1 answer
SQL Server 2008 Spatial Query. How to group polygons if they intersect each other?
In my table there is a geometry field that stores polygons.
The polygons that intersects each other must be attached to and form a single polygon (see below)
(source: location-world.com)
The results can not be calculated but must be executed on…

harleyrjacome
- 31
- 3