Skip to content

Instantly share code, notes, and snippets.

@farhan-raza
Created November 29, 2022 18:31
Show Gist options
  • Save farhan-raza/334af4961eb28ce1b606c938dbe88200 to your computer and use it in GitHub Desktop.
Save farhan-raza/334af4961eb28ce1b606c938dbe88200 to your computer and use it in GitHub Desktop.
Shapefile to SVG | Convert SHP to SVG in C# .NET
// Create a map
using (var map = new Aspose.Gis.Rendering.Map(800, 400))
{
// Use the specified SRS
map.SpatialReferenceSystem = Aspose.Gis.SpatialReferencing.SpatialReferenceSystem.Wgs84;
// Use the specified style to draw lines
// We also have styles for points, lines, and surfaces.
var symbolizer = new Aspose.Gis.Rendering.Symbolizers.SimpleLine() { Width = Aspose.Gis.Rendering.Measurement.Pixels(2) };
// Open a layer and add to the map
map.Add(Aspose.Gis.VectorLayer.Open(dataDir + "land.shp", Aspose.Gis.Drivers.Shapefile), symbolizer);
// Render the map to Svg format
map.Render(dataDir + "land_out.svg", Aspose.Gis.Rendering.Renderers.Svg);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment