Mapshaper.Net 0.3.0

dotnet add package Mapshaper.Net --version 0.3.0
                    
NuGet\Install-Package Mapshaper.Net -Version 0.3.0
                    
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="Mapshaper.Net" Version="0.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Mapshaper.Net" Version="0.3.0" />
                    
Directory.Packages.props
<PackageReference Include="Mapshaper.Net" />
                    
Project file
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 Mapshaper.Net --version 0.3.0
                    
#r "nuget: Mapshaper.Net, 0.3.0"
                    
#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 Mapshaper.Net@0.3.0
                    
#: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=Mapshaper.Net&version=0.3.0
                    
Install as a Cake Addin
#tool nuget:?package=Mapshaper.Net&version=0.3.0
                    
Install as a Cake Tool

Mapshaper.Net

CI

A thin .NET wrapper around the external mapshaper CLI.

This package does not bundle mapshaper. Install mapshaper separately and ensure mapshaper is available on PATH, or pass the executable path through MapshaperOptions.

Features

  • Runs the external mapshaper CLI from .NET code.
  • Captures exit code, standard output, standard error, and the exact argument list used.
  • Provides convenience methods for common workflows like convert, simplify, clean, erase, join, rename fields, and inspect info.
  • Includes a fluent pipeline builder for composing mapshaper command sequences.
  • Supports raw mapshaper arguments for commands that are not modeled directly.
  • Targets netstandard2.0 for broad .NET compatibility.

Requirements

  • A .NET runtime compatible with netstandard2.0. The library is intended to run on major .NET-supported operating systems, including Windows, Linux, and macOS.
  • .NET SDK for development and testing.
  • Node.js and the external mapshaper CLI at runtime.

Thin wrapper philosophy

Mapshaper.Net does not parse geospatial files or reimplement mapshaper behavior. It invokes the external mapshaper CLI safely, passes arguments through in a predictable way, and captures the process output so .NET code can inspect success, errors, stdout, and stderr.

Install mapshaper

Mapshaper requires Node.js. After installing Node.js, install the mapshaper command line tools globally with npm:

npm install -g mapshaper

Confirm the executable is available:

mapshaper -v

If mapshaper is not on PATH, pass the executable name or path through configuration. The exact path depends on the operating system and installation method.

var client = new MapshaperClient(new MapshaperOptions
{
    ExecutablePath = Environment.GetEnvironmentVariable("MAPSHAPER_PATH") ?? "mapshaper"
});

Install Mapshaper.Net

Install the package from NuGet:

dotnet add package Mapshaper.Net

Usage

using Mapshaper.Net;

var client = new MapshaperClient();

var result = await client.SimplifyAsync(
    "input.geojson",
    "output.geojson",
    "10%");

result.EnsureSuccess();

Use RunAsync() for raw mapshaper arguments:

var result = await client.RunAsync("input.geojson", "-simplify", "10%", "-o", "output.geojson");

Use high-level helpers for common file workflows:

await client.CleanAsync("input.geojson", "clean.geojson");
await client.RenameFieldsAsync("clean.geojson", ["NAME=label"], "renamed.geojson");

var info = await client.InfoAsync("renamed.geojson");

Use CreatePipeline() to compose thin wrappers for mapshaper commands:

var result = await client
    .CreatePipeline("input.geojson")
    .Clean()
    .Filter("POP > 0")
    .RenameFields("NAME=label")
    .Output("output.geojson", new MapshaperOutputOptions { Force = true })
    .RunAsync();

Pass modeled options for common import and output flags:

var result = await client.ConvertAsync(
    "input.geojson",
    "output.json",
    new MapshaperCommandOptions
    {
        Quiet = true,
        Import = new MapshaperImportOptions
        {
            Encoding = "utf8",
            IdField = "SOURCE_ID"
        },
        Output = new MapshaperOutputOptions
        {
            Format = "geojson",
            Precision = "0.000001",
            Force = true
        }
    });

Configure the executable:

var client = new MapshaperClient(new MapshaperOptions
{
    ExecutablePath = Environment.GetEnvironmentVariable("MAPSHAPER_PATH") ?? "mapshaper"
});

Handling failures

RunAsync() returns a MapshaperResult so callers can inspect the process result themselves:

var result = await client.RunAsync("input.geojson", "-info");

if (!result.IsSuccess)
{
    Console.Error.WriteLine(result.StdErr);
}

Use RunOrThrowAsync() or EnsureSuccess() when unsuccessful mapshaper exits should throw a MapshaperException.

await client
    .CreatePipeline("input.geojson")
    .Simplify("10%")
    .Output("output.geojson")
    .RunOrThrowAsync();

Development

Restore, build, and test the repository with the .NET SDK:

dotnet restore
dotnet build
dotnet test

Integration tests that execute mapshaper require the mapshaper command to be installed and available on PATH.

Documentation

Releasing

Package versions are derived from Git tags. See RELEASE.md for the release process and CHANGELOG.md for version history.

Contributing

Contributions are welcome. Please read CONTRIBUTING.md before opening an issue or pull request.

License

This project is licensed under the MIT License. See LICENSE for details.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.3.0 127 6/18/2026
0.2.0 193 6/17/2026
0.1.0 116 6/15/2026
0.0.2 102 6/15/2026
0.0.1 112 6/15/2026