Skip to content

Instantly share code, notes, and snippets.

@farhan-raza
Created November 29, 2022 18:31
Show Gist options
  • Save farhan-raza/a056487cc5991e6da097844df6269365 to your computer and use it in GitHub Desktop.
Save farhan-raza/a056487cc5991e6da097844df6269365 to your computer and use it in GitHub Desktop.
Convert KML to SHP Programmatically in C# .NET | KML to SHP converter
// Specify conversion settings.
Aspose.Gis.ConversionOptions options = null;
// This options assigns Wgs84 to the destination layer.
if (Aspose.Gis.Drivers.Shapefile.SupportsSpatialReferenceSystem(Aspose.Gis.SpatialReferencing.SpatialReferenceSystem.Wgs84))
{
options = new Aspose.Gis.ConversionOptions()
{
DestinationSpatialReferenceSystem = Aspose.Gis.SpatialReferencing.SpatialReferenceSystem.Wgs84,
};
}
// Convert file format from KML to SHP
Aspose.Gis.VectorLayer.Convert("second.kml", Aspose.Gis.Drivers.Kml, "destination.shp", Aspose.Gis.Drivers.Shapefile, options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment