Questions tagged [sqlgeography]

The MS SQL Server SqlGeography type represents data in a geodetic (round earth) coordinate system.

264 questions
0
votes
1 answer

MSSQL geography::STIntersects returns incorrect results when on or very close to a bounding box edge. What is the correct way to "Fix" this

Consider the following (derived from SQL Geography point inside polygon not returning true on STIntersect (but returns true using Geometry)) -- TEST CASE1 DECLARE @point1 GEOGRAPHY = GEOGRAPHY::STGeomFromText('POINT (0 -0.0000001)', 4326) DECLARE…
0
votes
0 answers

SQL Geography to Collection

I am using SQL Server 2016, C# (.NET 5), and PetaPoco as my ORM. I am getting the geography data from my data table by using the following in my SELECT clause: CASE WHEN Jurisdiction.GeographicArea IS NULL THEN NULL ELSE…
David
  • 5,877
  • 3
  • 23
  • 40
0
votes
2 answers

Why is this SQL Geometry invalid?

Edit - I provided the wtk of the poly I had made valid. Updated with the invalid string. Sorry this seems to have turned by mind to mush. I have a python process using that cuts an input dataset by a quad tree grid so that there are no polygons with…
0
votes
1 answer

How to define a geography column in a table with different columns type at SQL database

Consider I have a table with different columns types: CREATE TABLE [RentedHome] ( [HomeID] INT NOT NULL PRIMARY KEY CLUSTERED, [Address] CHAR (255) NOT NULL CHECK (LEN(Address) >= 2), [Landlord] CHAR (100) NOT NULL CHECK…
amin
  • 93
  • 8
0
votes
1 answer

Efficient SQL Geography wilcard name search for 20mill+ records

We have a SQL 2008 database with 20million+ geoWe locations (and growing) , each location includes the standard name/address/Geography/ID/Etc columns. We need a way to efficiently search through the records based on a distance but also a "contains"…
0
votes
1 answer

SQL Server Geography - Find International Dateline and Equator

In SQL Server, I want to find if geography intersects/crosses the international dateline and equator. I thought of the below logic but am not sure if it is the right way of doing this. Geography crossing international date line: if the coordinates…
Reyan Chougle
  • 4,917
  • 2
  • 30
  • 57
0
votes
1 answer

SQL - Geography calculations

In SQL, I have geographies stored. I want to check if geography is covering more than half globe, if geography crosses the international dateline or if geography crosses the equator. I have come up with the below logic, now sure if it is…
Reyan Chougle
  • 4,917
  • 2
  • 30
  • 57
0
votes
1 answer

Points inside polygons - SQL Server T-SQL + geo

I have 2 tables, one containing a bunch of polygons like this CREATE TABLE [dbo].[GeoPolygons]( [OID] [int] IDENTITY(1,1) NOT NULL, [Version] [int] NULL, [entity_id] [varchar](200) NULL, [Geometry] [geometry] NULL ) and one…
Feargal Hogan
  • 169
  • 1
  • 8
0
votes
1 answer

Using geography type value with STContains function

Ok first, I'm storing Lat/Long location in a column of type geography in my SQL Server table. I try to get stores in a specific bounding box using STContains method, the only way I found to use the geography point, was by concatening the Lat/Long…
Jonathan Anctil
  • 1,025
  • 3
  • 20
  • 44
0
votes
0 answers

SQL Server geography and spatial functions

I have a table containing a series of records of rectangular areas on the earths surface that are of interest to me. I store these in a table like this CREATE TABLE [dbo].[Areas] ( [AreaID] [int] NOT NULL, [north] [decimal](8, 6) NULL, …
Feargal Hogan
  • 169
  • 1
  • 8
0
votes
0 answers

How do I improve SQL spatial query performance?

I am running a spatial query inside a SQL procedure, and I am experiencing some inconsistent performance times. I've have tried to use various spatial indexes, however I cannot seem to get the query to run more consistently and at a faster pace. The…
french
  • 41
  • 4
0
votes
0 answers

Querying geography data type from different servers

I'm on server1, it has a lot of dbs. I need to be able to query (select) geography type from different dbs specified. This works fine SELECT GeoField=geography::STGeomFromText(GeoField,4326) FROM (SELECT convert(nvarchar(max),GeoField) as GeoField…
Eric Klaus
  • 923
  • 1
  • 9
  • 24
0
votes
0 answers

"Specified type is not registered on the target server.Microsoft.SqlServer.Types.SqlGeography" Exception while working with SQLGeography data type

When trying to use SqlGeograpy I get the following error: Unhandled Exception: System.ArgumentException: Specified type is not registered on the target server.Microsoft.SqlServer.Types.SqlGeography, Microsoft.SqlServer.Types, Version=14.0.0.0,…
Shailendra
  • 153
  • 3
  • 11
0
votes
0 answers

A .NET Framework error occurred during execution of user-defined routine or aggregate "No extended information available." calling geography

I'm trying to pull lat/lon coordinates from one table and see if they intersect a particular area using geometry::STIntersect. However, I get the error in the title after the query has started running and producing results. This only happens…
0
votes
2 answers

using SqlGeography types in C# client-side

In C# client-side, I am trying to use the SQLServerTypes (SqlServerSpatial140.dll) assembly (edit: doing so directly, SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory)) to measure the distance between points on…
Tim
  • 8,669
  • 31
  • 105
  • 183