Map Rendering refers to making visual maps from geospatial data. You can render maps from KML, GeoJSON, GeoTIFF, as well as the Shapefile to different file formats. You can render maps to different image formats like PNG, SVG, JPG, etc. The following sections will elaborate the map rendering to images:
- Map Rendering from a Shapefile to Images – C# API Installation
- Render Map from Shapefile to SVG Programmatically using C#
- Render Map from Shapefile to PNG Image Programmatically in C#
- Custom Map Rendering with Advance Style using C#
- Render Map from GeoTIFF format to SVG Programmatically using C#
Map Rendering from a Shapefile to Images – C# API Installation
Aspose.GIS for .NET API lets you work with different geographical and geo-spatial file formats. You can render maps from supported file formats to SVG, PNG, and other file formats as per your requirements. Please configure the API by downloading it from the New Releases section, or you can use the following NuGet installation command on the package manager console.
PM> Install-Package Aspose.GIS
Render Map from Shapefile to SVG Programmatically using C#
You can render map from a shapefile to an SVG file with the following steps:
- Create a new instance of the Map class.
- Create a vector map layer and add it to the map.
- Render the map into a file.
The code below elaborates how to render a map from a Shapefile to SVG programmatically using C#;
Render Map from Shapefile to PNG Image Programmatically in C#
You can render map from a shapefile to raster image formats like PNG, JPG, BMP, etc. The following are the steps for rendering map from shapefile to PNG image:
- Initialize Map class object with dimensions.
- Create and add a vector map layer.
- Render the map to a PNG image.
The following code shows map rendering from Shapefile to PNG image programmatically using C#:
Custom Map Rendering with Advance Style using C#
You can customize the appearance of a map with advance feature styles. Please follow the steps below for custom map rendering:
- Initialize Map class object.
- Initialize SimpleFill for a simple polygon symbolizer.
- Open the layer from the input shapefile for reading.
- Render the map into a file.
The code below explains how to do custom map rendering with advanced style using C#:
Render Map from GeoTIFF format to SVG Programmatically using C#
You can render a map from GeoTIFF to SVG file with the following steps:
- Instantiate Map class object.
- Open the layer for reading using the driver for the GeoTIFF or TIFF format.
- Render map into a file.
The code snippet below demonstrates how to render map from GeoTIFF format to SVG programmatically using C#:
Get Free API License
You can evaluate the API with a Free Temporary License for testing the API without any limitations.
Conclusion
In this article, you have learned map rendering from shapefile or GeoTIFF format to SVG, or other raster image formats like PNG, JPG, TIFF, etc. You can explore other features of the API by visiting the Documentation. Please feel free to contact us via Free Support Forum in case of any queries.
See Also
Create KML File or Read its Features Programmatically using C#