sqlgeometry

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

Looking for the opposite of SqlGeometryBuilder: How can I decompose a SqlGeometry?

感情迁移 提交于 2020-01-07 02:50:06
问题 I know how to compose a SqlGeometry using SqlGeometryBuilder , for example: // using Microsoft.SqlServer.Types; SqlGeometryBuilder geometryBuilder = new SqlGeometryBuilder(); geometryBuilder.SetSrid(…); geometryBuilder.BeginGeometry(OpenGisGeometryType.Polygon); geometryBuilder.BeginFigure(0, 0); geometryBuilder.AddLine(…); … geometryBuilder.EndFigure(); geometryBuilder.EndGeometry(); SqlGeometry geometry = geometryBuilder.ConstructedGeometry; Once a SqlGeometry is built, it's pretty much an

Convert coordinate systems using SQLGeometery

偶尔善良 提交于 2019-12-13 02:53:49
问题 One of my shape files looks like this: POLYGON ( -91.513078999999991 36.970298, -87.01993499999999 36.970298, -87.01993499999999 42.508337999999995, -91.513078999999991 42.508337999999995, -91.513078999999991 36.970298) Another file is using SRID 3857: POLYGON ( -10033572.109485552 4727287.954831399, -10033571.708142675 4727287.954831399, -10033571.708142675 4727288.1439229213, -10033572.109485552 4727288.1439229213, -10033572.109485552 4727287.954831399) Assuming I can figure out which

Group by value and create geography polyline from points (latitude and longitude) for each group in T-SQL

烂漫一生 提交于 2019-12-12 08:56:30
问题 A similar question has been asked here: Create geography polyline from points in T-SQL Taking that question further, I have a table schema that looks like this: CREATE TABLE [dbo].[LongAndLats]( [Longitude] [float] NULL, [Latitude] [float] NULL, [SortOrder] [bigint] NULL, [SensorID] [bigint] NULL, ) Sample data looks like this: How can I convert these points into a geography polyline for each SensorID using TSQL (so that I would have a SensorID/Polyline record for each SensorID)? I've tried

SqlBulkCopy DataTable with WellKnownText spatial data column

家住魔仙堡 提交于 2019-12-08 17:12:09
问题 I'm trying to bulk copy a DataTable which has the following columns: "ID" - System.Int32 "Geom" - System.String Into a SQL database with the following columns: "Id" - int "Shape" - geometry Can anyone advise on the best way to do this? Some test code if it helps... DataTable dataTable = new DataTable(); dataTable.Columns.Add("ID", typeof(Int32)); dataTable.Columns.Add("Geom", typeof(String)); dataTable.Rows.Add(1, "POINT('20,20')"); dataTable.Rows.Add(1, "POINT('40,25')"); dataTable.Rows.Add

Is the SQL Server 2012 version of Microsoft.SqlServer.Types' geometry UDT backward compatible with SQL Server 2008?

回眸只為那壹抹淺笑 提交于 2019-11-29 12:36:36
问题 If I had both SQL Server 2008 and SQL Server 2012 installed locally, I would simply try this for myself; however I only have the newer version installed and would like to keep it that way. SQL Server 2008 comes with an assembly Microsoft.SqlServer.Types.dll , major version 10. SQL Server 2012 comes with an assembly Microsoft.SqlServer.Types.dll , major version 11. Among other things, both assemblies expose a SqlGeometryBuilder type. The one notable difference between the two assembly versions