این صفحه هنوز ترجمه نشده است؛ نسخهٔ انگلیسی نمایش داده میشود.
IRI.Maptor.Core.ShapefileFormat
ESRI shapefile read and write support for the Maptor stack: SHP geometry, SHX index, DBF attributes with code-page-aware text decoding, PRJ coordinate system files, and reprojection on load or save.
Installation
dotnet add package IRI.Maptor.Core.ShapefileFormat
Features
- Read shapefiles as raw ESRI shapes (
Shapefile.ReadShapes/ReadShapesAsync) or as attributed features (Shapefile.ReadAsFeature/ReadAsFeatureAsyncreturningFeature<Point>) - All ESRI shape types:
Point,Polyline,Polygon,MultiPointplus their M and Z variants - Write shapefiles from ESRI shapes,
Feature<Point>lists, or GeoJSON features (Shapefile.Save,SaveAsShapefile) - DBF attribute reading/writing with configurable encodings, FoxPro code-page detection,
.cpgfile support, and optional Persian (Farsi) character correction - PRJ support:
TryReadPrjFile/TryGetSrson read,SaveAsPrjon write - Reprojection:
Project,ProjectAsync, andProjectAndSaveAsShapefilebetween spatial reference systems (SrsBase) - SHX index reading and writing
- Conversion helpers to the native geometry model (
AsGeometry), SQL Server WKT (AsSqlServerWkt), and GeoJSON
Usage
Read a shapefile:
using IRI.Maptor.Core.ShapefileFormat;
// raw ESRI shapes
var shapes = await Shapefile.ReadShapesAsync("data/parcels.shp");
foreach (var shape in shapes)
{
Console.WriteLine(shape.AsSqlServerWkt());
}
// as features with DBF attributes
var features = Shapefile.ReadAsFeature("data/parcels.shp", defaultSrid: 4326);
Write features back to a shapefile:
using IRI.Maptor.Core.ShapefileFormat;
Shapefile.SaveAsShapefile("output/result.shp", features);
Reproject a shapefile on save:
using IRI.Maptor.Core.ShapefileFormat;
using IRI.Maptor.Core.SpatialReferenceSystem.MapProjections;
Shapefile.ProjectAndSaveAsShapefile(
"data/parcels.shp", "output/parcels-mercator.shp",
SrsBases.WebMercator, overwrite: true);
Dependencies
IRI.Maptor.Core.Common,IRI.Maptor.Core.Ogc,IRI.Maptor.Core.Spatial