quantized-mesh-tile 0.5.0

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

quantized-mesh-tile-cs

NuGet Status

A .NET Standard 2.0 library for decoding a terrain tile (quantized mesh format).

More info about the quantized mesh format: https://github.com/AnalyticalGraphicsInc/quantized-mesh

For more awesome quantized mesh implementations see https://github.com/bertt/awesome-quantized-mesh-tiles

Installation

PM> Install-Package quantized-mesh-tile

Usage: Decoding

const string terrainTileUrl = @"https://geodan.github.io/terrain/samples/heuvelrug/tiles/13/8432/6467.terrain";

var client = new HttpClient();
var stream = await client.GetStreamAsync(terrainTileUrl);
var terrainTile = TerrainTileParser.Parse(stream);
Console.WriteLine("Number of vertices: " + terrainTile.VertexData.vertexCount);
Console.ReadLine();

Usage: Encoding

Encode a list of WKT POLYGON Z triangles into a quantized-mesh tile byte stream. The tile coordinates (z, x, y) follow the TMS scheme and determine the geographic extent.

var triangles = new List<string>
{
    "POLYGON Z ((7.38 44.65 303, 7.38 45.0 320, 7.56 44.82 310, 7.38 44.65 303))",
    "POLYGON Z ((7.38 44.65 303, 7.73 44.65 350, 7.56 44.82 310, 7.38 44.65 303))"
};

byte[] bytes = TerrainTileEncoder.Encode(triangles, z: 9, x: 533, y: 383);
File.WriteAllBytes("output.terrain", bytes);

The encoder:

  • Deduplicates vertices and quantizes coordinates to [0, 32767]
  • Computes the tile header (ECEF center, bounding sphere, height range)
  • Identifies edge vertices (west, south, east, north borders)
  • Serializes all sections to the quantized-mesh binary format

Benchmark

|                    Method |     Mean |    Error |   StdDev |
|-------------------------- |---------:|---------:|---------:|
| ParseVectorTileFromStream | 46.74 us | 0.099 us | 0.087 us |

Sample: convert to GeoJSON

See samples/qm2geojson, sample code for converting a quantized mesh tile to GeoJSON.

Result: see https://github.com/bertt/quantized-mesh-tile-cs/blob/master/samples/qm2geojson/triangles.geojson

Sample visualization:

heightmap

History

26-04-22: release version 0.5 with quantized-mesh tile encoding support

23-05-26: release version 0.4 to .NET 6

18-12-28: release version 0.3 with BinaryReader instead of FastBinaryReader

18-12-05: release version 0.2 with new .NET project file and conversion to WGS84 (method GetTriangles) removed.

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.5.0 40 4/22/2026
0.4.0 377 5/26/2023
0.3.0 1,039 12/28/2018
0.2.0 963 12/5/2018
0.1.10 1,480 1/11/2017
0.1.9 1,383 1/10/2017
0.1.8 1,358 1/10/2017
0.1.7 1,376 1/5/2017
0.1.6 1,378 1/5/2017
0.1.5 1,524 1/4/2017
0.1.4 1,354 1/4/2017
0.1.3 1,465 1/2/2017
0.1.2 1,393 12/28/2016
0.1.1 1,417 12/22/2016
0.1.0 1,408 12/22/2016

Targets netstandard2.0 + adding tile writer