GeoJson.aot 1.0.0

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

GeoJson.aot

A fast and easy-to-use serializer for the GeoJSON format. NativeAOT-compatible and trim safe.

NuGet package

Features

  • RFC 7946 compliant. Including custom feature property types and alternative coordinate reference systems as described in the 2008 specification.
  • NativeAOT-compatibel and trim safe.
  • Leveraging the System.Text.Json source generator under the hood.
  • Fast and memory efficient.
  • Easy to use but highly configurable™.
  • Feature and FeatureCollection are using properties of type IDictionary<string, object?> but can be customized with specialized properties type.
  • Choose coordinate precision: double, float, Half or decimal
  • Choose positions:
    • 2D (without altitude) or
    • 3D (with optional altitude)

Usage

Deserialization from stream (2D positions, double precision)
using GeoJson;

namespace Samples;

using static Geo<Position2D<double>, double>;

public static class Simple
{
    public static async Task Deserialization(Stream stream)
    {
        FeatureCollection? collection = await GeoDouble2D.Default.DeserializeAsync<FeatureCollection>(stream);
    }
}
Serialization into stream with customized JSON options (3D positions, single precision)
using System.Text.Json;
using GeoJson;

namespace Samples;

using static Geo<Position3D<float>, float>;

public class WithOptions
{
    private readonly GeoSingle3D _geo = new(new JsonSerializerOptions { WriteIndented = true });

    public async Task Serialization(Stream stream, MultiPolygon geometry)
    {
        await _geo.SerializeAsync(stream, geometry);
    }
}
Deserialization from string with specialized feature property type and JSON options (2D positions, single precision)
using System.Text.Json.Serialization;
using GeoJson;

namespace Samples;

using static Geo<Position2D<float>, float>;

public class WithFeatureProperties
{
    private readonly GeoSingle2D _geo = new(MyContext.Default, typeof(MyProperties));

    public void Deserialization(string json)
    {
        Feature<MyProperties>? feature = _geo.Deserialize<Feature<MyProperties>>(json);
        if (feature is not null)
        {
            Console.WriteLine(feature.Properties.Speed);
        }
    }
}

public record struct MyProperties(string Name, int Distance, float Speed);

[JsonSerializable(typeof(Feature<MyProperties>))]
[JsonSerializable(typeof(FeatureCollection<MyProperties>))]
[JsonSourceGenerationOptions(WriteIndented = true)]
public sealed partial class MyContext : JsonSerializerContext
{ }
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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.
  • net9.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
1.0.0 144 5/9/2025
1.0.0-preview.5 120 5/8/2025
1.0.0-preview.1 124 5/8/2025