IRI.Maptor.Infrastructure.SqlServerSpatialExtension

NuGet Target

Extension methods and helpers for working with SQL Server spatial types (SqlGeometry, SqlGeography) alongside the Maptor geometry model — conversions to Geometry<Point>, GeoJSON, GML, and helpers for building SQL Server spatial values from other formats. All extension methods live in the IRI.Maptor.Extensions namespace.

Installation

dotnet add package IRI.Maptor.Infrastructure.SqlServerSpatialExtension

Features

  • SqlGeometryExtensions — convert SqlGeometry to Maptor Geometry<Point> (AsGeometry), export GeoJSON (AsGeoJson), tile helpers (TileInfo.AsSqlGeometry), and WKT/projection utilities
  • SqlGeographyExtensions — point extraction (AsPoint), reprojection to SqlGeometry (Project, GeodeticWgs84ToWebMercator, ...), GeoJSON and WKT export
  • GeometryExtensions — geodesic area (GetTrueArea), IPoint to SqlGeography, OpenGIS geometry-type mapping
  • BoundingBoxExtensions — Maptor BoundingBox to SqlGeometry envelope
  • FeatureExtensionsList<Feature<Point>> to DataTable
  • GeoJsonExtensions — GeoJSON geometry to SqlGeometry / SqlGeography (and back via AsGeoJson)
  • GmlExtensionsSqlGeometry to GML3 (AsGml3) and GML3 parsing (ParseGML3)
  • GpxExtensions — GPX waypoints, track points, segments, and tracks to SqlGeography
  • ShapefileExtension — ESRI Shapefile shapes to SqlGeometry
  • SqlSpatialHelper / SqlSpatialUtility — WKT and Esri JSON parsing, empty-geometry builders, bounding boxes from envelopes, union, and point-collection/linestring construction

Usage

using IRI.Maptor.Extensions;

// SqlGeometry -> Maptor geometry
Geometry<Point> geometry = sqlGeometry.AsGeometry();

// SqlGeometry -> GeoJSON
var geoJson = sqlGeometry.AsGeoJson();

// Maptor bounding box -> SqlGeometry envelope
SqlGeometry envelope = boundingBox.AsSqlGeometry(srid: 3857);

NuGet package · Report issues · Back to IRI.Maptor.Infrastructure