Pmad.Cartography.Drawing
0.1.23
dotnet add package Pmad.Cartography.Drawing --version 0.1.23
NuGet\Install-Package Pmad.Cartography.Drawing -Version 0.1.23
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Pmad.Cartography.Drawing" Version="0.1.23" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Pmad.Cartography.Drawing" Version="0.1.23" />
<PackageReference Include="Pmad.Cartography.Drawing" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Pmad.Cartography.Drawing --version 0.1.23
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Pmad.Cartography.Drawing, 0.1.23"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Pmad.Cartography.Drawing@0.1.23
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Pmad.Cartography.Drawing&version=0.1.23
#tool nuget:?package=Pmad.Cartography.Drawing&version=0.1.23
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Pmad.Cartography.Drawing
A .NET library for rendering topographic maps and contour overlays. It combines Pmad.Cartography (DEM/contour data) with Pmad.Drawing (vector output) to produce publication-quality maps in SVG, PNG/WebP and PDF.
Installation
dotnet add package Pmad.Cartography.Drawing
Getting started
Render contour lines
// Build contours from a DEM view
var contour = new ContourGraph();
contour.Add(area, new ContourLevelGenerator(10, 10));
// Render to any IDrawSurface
Render.ToSvg("contours.svg", new Vector2D(1024, 1024), surface =>
{
var renderer = new ContourRender(surface);
renderer.Render(contour, projectionArea, hillshadeImage);
});
Render a full topographic map
// Populate map data (roads, forests, water, buildings, etc.)
// myTopoMapData implements ITopoMapData
using var scope = new NoProgress();
var data = TopoMapRenderData.Create(myTopoMapData, scope);
var proj = new NoProjectionArea(min, max, new Vector2D(width, height));
Render.ToSvgTiled("map.svg", proj.Size, SvgFallBackFormats.Webp,
drawLod1: surface => new TopoMapRender(data, proj).Render(surface),
drawLod2: surface => new TopoMapRender(data, proj).RenderLod2(surface),
drawLod3: surface => new TopoMapRender(data, proj).RenderLod3(surface));
Export as PDF
// myTopoMapData implements ITopoMapData
System.IO.Directory.CreateDirectory("output-dir");
using var scope = new NoProgress();
var pdfFiles = TopoMapPdfRender.RenderPDF("output-dir", "map", myTopoMapData, scope);
Map data model
ITopoMapData / TopoMapData carries all vector layers that the renderer understands:
| Property | Type | Description |
|---|---|---|
DemDataCell |
IDemDataView |
Elevation raster (required) |
Roads |
Dictionary<TopoMapPathType, MultiPath> |
Road network by category |
Bridges |
Dictionary<TopoMapPathType, MultiPath> |
Bridge segments |
Railways |
MultiPath |
Rail lines |
Powerlines |
MultiPath |
Power line routes |
ForestPolygons |
MultiPolygon |
Forested areas |
RockPolygons |
MultiPolygon |
Rock/cliff areas |
WaterPolygons |
MultiPolygon |
Water bodies |
BuildingPolygons |
MultiPolygon |
Building footprints |
FortPolygons |
MultiPolygon |
Fortification areas |
Names |
List<TopoLocation> |
Named locations with type and position |
Icons |
List<TopoIcon> |
Point-of-interest icons |
PlottedPoints |
List<DemDataPoint> |
Labelled elevation spot heights |
Map metadata
var metadata = new TopoMapMetadata(
attribution: "Map data (c) OpenStreetMap contributors",
title: "My Topographic Map",
licenseNotice: "CC BY-SA 4.0",
exportCreator: "MyApp 1.0",
upperTitle: "Sheet 1");
Level-of-detail rendering
TopoMapRender exposes three LOD methods that progressively simplify the map for smaller zoom levels:
| Method | Detail level | Typical use |
|---|---|---|
Render |
Full detail | Maximum zoom |
RenderLod2 |
Reduced | Medium zoom |
RenderLod3 |
Minimal | Overview zoom |
Key types
| Type | Description |
|---|---|
ContourRender |
Draws a ContourGraph onto an IDrawSurface, with optional hillshade underlay |
ContourRenderStyle |
Default contour styling (thin lines every 10 m, bold every 50 m) |
TopoMapRender |
Full topographic map renderer |
TopoMapPdfRender |
PDF-specific renderer with page layout and legend |
TopoMapStyle |
Colour palette and style factory for all map layers |
ColorPalette |
Default colour values used by TopoMapStyle |
LegendRender |
Draws the map legend |
NoProjectionArea |
Simple pixel-to-coordinate projection for flat/local maps |
Dependencies
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Pmad.Cartography (>= 0.1.23)
- Pmad.Drawing (>= 0.1.23)
- Pmad.ProgressTracking (>= 0.1.28)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.