sqlgeography

STContains - tests failing for points INSIDE polygon

元气小坏坏 提交于 2020-06-17 15:12:35
问题 First, SQL version: Microsoft SQL Server 2016 (RTM) - 13.0.1601.5 (X64) Apr 29 2016 23:23:58 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows Server 2012 R2 Standard 6.3 (Build 9600: ) (Hypervisor) I declare a single closed polygon (correctly oriented using left-hand rule), which according to SQL is valid: DECLARE @g geography; SET @g = geography::STPolyFromText('POLYGON((-141.251221 60.177476, -134.351807 52.952478, -124.859620 48.440718, -123.623658 48.163009, -123

Microsoft.SqlServer.Types incompatible with .NET Standard

久未见 提交于 2020-03-03 02:37:48
问题 I'm attempting to convert all of our C# class libraries from .NET Framework to .NET Standard projects, as we are starting to leverage .NET Core so need these to be consumable by both .NET Core and .NET Framework apps (with the latter being ported over to Core in the upcoming months.) I'm having trouble converting our data access layer code, because we leverage Microsoft.SqlServer.Types extensively and the official nuget package doesn't support .NET Standard. I tried an unofficial nuget

SQL Geography data type column in GROUP BY clause

寵の児 提交于 2020-01-24 05:49:39
问题 I'm using SQL Server and creating a script which will get the workers geographical location out of my database. The script is below. SELECT w.display_name, w.geo_location FROM jobs j WITH(NOLOCK) INNER JOIN workers w WITH(NOLOCK) ON w.worker_id = j.worker_id WHERE ..... The problem is that I want to add GROUP BY w.display_name, w.geo_location to the script as there are duplicate records being shown. Added a column with the data type geography to a group by clause causes an error to be thrown.

Ms SQL geography.STDistance returns wrong distance

白昼怎懂夜的黑 提交于 2020-01-15 12:04:18
问题 I'm trying to query any locations within a specified distance from another location. The query is not the problem, but the distance returned by geography.STDistance is. It seems STDistance makes fairly accurate calculations on locations close to the equator, but I need this to work with locations in the nordic countries. Norway, Sweden, Finland and so on... According to my calculations, made on locations in northern Sweden, the distance is wrong by a factor of around 2.38?! Expected result is

How to parse multiple geojson feature types and write to SQL Geography column

拟墨画扇 提交于 2020-01-05 08:27:17
问题 This is the follow up question from here. Given : A geojson file with 3 different geometry types (Point, Polygon, Line) and multiple properties ( AssetType , GeoID , etc.), write each geometry type and its corresponding properties to a single Azure SQL record which uses a Geography-type column. Work so far : I have separate SQL statements that will push the properties alone, then push the Polygon alone into a Geography-type column. But this results in the properties in one record and the

SqlGeography.STIntersection() returns even when I know there is no intersection

一世执手 提交于 2020-01-02 14:04:15
问题 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 through the LocationCollection of the polygon on the bing map, and creates a SqlGeography object (OpenGisGeographyType.Polygon) which is an instance of a polygon. We then convert the mouse click into SqlGeography object (OpenGisGeographyType.Point)