محول CSV إلى GeoJSON

استخدم مكتبة Aspose.GIS for .NET لتحويل CSV إلى تنسيق ملف GeoJSON.

مثال حي

تقدم لك Aspose.GIS for .NET / C# تطبيق “CSV to GeoJSON Converter” مجاني عبر الإنترنت، حيث يمكنك التحقق من الوظائف والجودة التي يعمل بها.

محول CSV إلى GeoJSON

نموذج التعليمات البرمجية - محول CSV إلى GeoJSON

يوضح مقتطف الشفرة التالي كيفية تنفيذ محول CSV إلى GeoJSON. إذا حددت نظام إسناد مكاني للطبقة GeoJSON الوجهة، فسيتم تحويل جميع الهندسات إليه.

// 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 CSV to GeoJSON.
VectorLayer.Convert("source.csv", Drivers.Csv, "destination.geojson", Drivers.GeoJson, options);

يعرض هذا المثال الإمكانيات العامة. لدى Aspose.GIS for .NET خيارات واسعة لتحويل الملفات. لكل تنسيق يعتمد على المتجهات خيارات القراءة / الكتابة الخاصة به والتي يتم توريثها من الفئة DriverOptions.

المنصة - .NET / C#

نحن ندعم Framework 4.7 أو أحدث على نظام Windows، و .NET Core 2.0 أو أحدث على نظام Windows أو Linux.