SqlSpatial.Simplify 1.0.2

dotnet add package SqlSpatial.Simplify --version 1.0.2                
NuGet\Install-Package SqlSpatial.Simplify -Version 1.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SqlSpatial.Simplify" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SqlSpatial.Simplify --version 1.0.2                
#r "nuget: SqlSpatial.Simplify, 1.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SqlSpatial.Simplify as a Cake Addin
#addin nuget:?package=SqlSpatial.Simplify&version=1.0.2

// Install SqlSpatial.Simplify as a Cake Tool
#tool nuget:?package=SqlSpatial.Simplify&version=1.0.2                

Polygon + LineString Simplification SqlClr for SQL Server Spatial Geographies

Install

DROP ASSEMBLY IF EXISTS SqlSpatialClr; 

CREATE ASSEMBLY SqlSpatialClr FROM '/where/uploaded/to/mssql/server/SqlSpatial.Simplify.dll' WITH PERMISSION_SET = SAFE; 

CREATE FUNCTION dbo.SimplifyByArea(@polygon GEOGRAPHY, @tolerance FLOAT) RETURNS GEOGRAPHY AS EXTERNAL NAME SqlSpatialClr.[SqlSpatial.Simplify.SqlClrWrapper].SimplifyByMinimumArea; GO
CREATE FUNCTION dbo.SimplifyByPercentage(@polygon GEOGRAPHY, @perentage FLOAT) RETURNS GEOGRAPHY AS EXTERNAL NAME SqlSpatialClr.[SqlSpatial.Simplify.SqlClrWrapper].SimplifyByPercentagePointsRetained; GO
 
GO


Update

You may need to DROP the functions first if the code's C# signatures have changed.

ALTER ASSEMBLY SqlSpatialClr FROM '/where/uploaded/to/mssql/server/SqlSpatial.Simplify.dll'; 

Uninnstall

DROP FUNCTION IF EXISTS dbo.SimplifyByArea; GO
DROP FUNCTION IF EXISTS dbo.SimplifyByPercentage; GO

DROP ASSEMBLY IF EXISTS SqlSpatialClr; 

Example usage


-- simplify by retaining 5% of the largest-area points
DECLARE @percentage FLOAT = 5.0;
DECLARE @geography GEOGRAPHY = (SELECT SomeHugeBoundary FROM lovely_big_city_table WHERE id = 31415);
SELECT dbo.SimplifyByPercentage(@geography, @percentage) AS simplified; 

-- simplify by dropping points with a triangular area under 200m
DECLARE @tolerance FLOAT = 200.0;
DECLARE @geography GEOGRAPHY = (SELECT SomeHugeBoundary FROM lovely_big_city_table WHERE id = 31415);
SELECT dbo.SimplifyByArea(@geography, @tolerance) AS simplified;
Product Compatible and additional computed target framework versions.
.NET Framework net481 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 106 6/28/2024
1.0.1 96 6/28/2024