KML 到 Shapefile 转换器
使用 Aspose.GIS for .NET 库将 KML 转换为 Shapefile 文件格式。
在线示例
Aspose.GIS for .NET / C# 在线免费提供 “KML 到 Shapefile 转换器” 应用程序,您可以在其中调查其功能和质量。
代码示例 - KML 到 Shapefile 转换器
以下代码片段向您展示如何实现 KML 到 Shapefile 转换器。 如果您为目标 Shapefile 图层指定了空间参考系统,则所有几何图形都将转换为该系统。
// For complete examples and data files, please go to https://github.com/aspose-gis/Aspose.GIS-for-.NET | |
// Specify conversion settings if necessary. It is optional. | |
ConversionOptions options = null; | |
// This options assigns Wgs84 to the destination layer. | |
// Conversion may throw error If destination layer does not support the Wgs84 spatial reference. So need to check. | |
if (Drivers.Shapefile.SupportsSpatialReferenceSystem(SpatialReferenceSystem.Wgs84)) | |
{ | |
options = new ConversionOptions() | |
{ | |
DestinationSpatialReferenceSystem = SpatialReferenceSystem.Wgs84, | |
}; | |
} | |
// Convert file format from KML to Shapefile. | |
VectorLayer.Convert("source.kml", Drivers.Kml, "destination.shp", Drivers.Shapefile, options); |
此示例显示了常规的可能性。 Aspose.GIS for .NET 具有广泛的选项来 转换文件。 每种基于矢量的格式都有自己的读取/写入选项,这些选项从 DriverOptions 类继承而来。
平台 - .NET / C#
我们支持 Windows 上的 Framework 4.7 或更高版本以及 Windows 或 Linux 上的 .NET Core 2.0 或更高版本。