Learn how to convert an OSM to KML in C#. https://blog.aspose.com/gis/convert-osm-to-kml-in-csharp/
This article shall cover the following topics:
Learn how to convert an OSM to KML in C#. https://blog.aspose.com/gis/convert-osm-to-kml-in-csharp/
This article shall cover the following topics:
// This code example demonstrates how to convert OSM to KML. | |
// 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 OSM to KML. | |
VectorLayer.Convert("C:\\Files\\sample.osm", Drivers.OsmXml, "C:\\Files\\destination.kml", Drivers.Kml, options); |