Convertidor de JSON a GeoJSON
Utilice la biblioteca Aspose.GIS para .NET para convertir JSON al formato de archivo GeoJSON.
Ejemplo en vivo
Aspose.GIS para .NET / C# le presenta en línea y gratis la aplicación “Convertidor de JSON a GeoJSON”, donde puede investigar la funcionalidad y la calidad con la que funciona.
Ejemplo de código - Convertidor de JSON a GeoJSON
El siguiente fragmento de código muestra cómo implementar un convertidor de JSON a GeoJSON. Si especifica un sistema de referencia espacial para la capa GeoJSON de destino, todas las geometrías se convertirán a él.
// 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 JSON to GeoJSON. | |
VectorLayer.Convert("source.geojson", Drivers.GeoJson, "destination.geojson", Drivers.GeoJson, options); |
Este ejemplo muestra las posibilidades generales. Aspose.GIS para .NET tiene amplias opciones para convertir archivos. Cada formato basado en vectores tiene sus propias opciones de lectura/escritura que se heredan de la clase DriverOptions.
Plataforma - .NET / C#
Admitimos Framework 4.7 o posterior en Windows y .NET Core 2.0 o posterior en Windows o Linux