HaemmerElectronics.SeppPenner.GeoJsonCircleToPolygon 1.0.3

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package HaemmerElectronics.SeppPenner.GeoJsonCircleToPolygon --version 1.0.3
NuGet\Install-Package HaemmerElectronics.SeppPenner.GeoJsonCircleToPolygon -Version 1.0.3
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="HaemmerElectronics.SeppPenner.GeoJsonCircleToPolygon" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HaemmerElectronics.SeppPenner.GeoJsonCircleToPolygon --version 1.0.3
#r "nuget: HaemmerElectronics.SeppPenner.GeoJsonCircleToPolygon, 1.0.3"
#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.
// Install HaemmerElectronics.SeppPenner.GeoJsonCircleToPolygon as a Cake Addin
#addin nuget:?package=HaemmerElectronics.SeppPenner.GeoJsonCircleToPolygon&version=1.0.3

// Install HaemmerElectronics.SeppPenner.GeoJsonCircleToPolygon as a Cake Tool
#tool nuget:?package=HaemmerElectronics.SeppPenner.GeoJsonCircleToPolygon&version=1.0.3

GeoJsonCircleToPolygon

GeoJsonCircleToPolygon is a library to generate GeoJSON representations of circles to polygon and a fork of https://github.com/gabzim/circle-to-polygon ported to C#. Special thanks to Gabriel Zimmermann, Johannes Jarbratt and Jan Žák for the original work.

Build status GitHub issues GitHub forks GitHub stars License: MIT Nuget NuGet Downloads Known Vulnerabilities Gitter

Available for

  • Net 6.0
  • Net 7.0
  • Net 8.0

Net Core and Net Framework latest and LTS versions

Basic usage

public void Test()
{
    // For decimals:
    var coordinatesDecimal = new decimal[] { 173.283966m, -41.270634m };
    var resultDecimal = CircleToPolygonHelperDecimal.GetPolygonFromCircle(coordinatesDecimal, 200000, 32);
    // For usage in the GeoJSON format.
    var featureCollectionDecimal = new GeoJsonFeatureCollectionDecimal();
    featureCollectionDecimal.AddCoordinates(resultDecimal);
    var geoJsonDecimal = featureCollectionDecimal.ToString();
    // -----------------------------------------------------------
    // For doubles:
    var coordinatesDouble = new double[] { 173.283966m, -41.270634m };
    var resultDouble = CircleToPolygonHelperDouble.GetPolygonFromCircle(coordinatesDouble, 200000, 32);
    // For usage in the GeoJSON format.
    var featureCollectionDouble = new GeoJsonFeatureCollectionDouble();
    featureCollectionDouble.AddCoordinates(resultDouble);
    var geoJsonDouble = featureCollectionDouble.ToString();
}

Parameters

  • center: The center coordinates: Array of length 2 or 3 (Required)
    • First element: Longitude (Required)
    • Second element: Latitude (Required)
    • Third element: Altitude (Ignored)
  • radiusInMeters: Radius in meters (Required)
  • numberOfEdges: The number of edges (Defaults to 32)
  • bearing: How many degrees the circle should be rotated which is most noticeable for "circles" with few edges (Defaults to 0)
  • direction: The direction of the circle (1 means right-hand-rule, -1 is opposite) (Defaults to 1)
  • earthRadius: The earth radius (Defaults to 6378137)

Disclaimers

  • A circle whose edge cross longitude edges (-180 or 180) or a latitude edge (-90 or 90) will contain coordinate points that are outside the standardized coordinates (eg: [182, 23]). This is because there are two ways to represent a line going from [179, x] to [181, y]. One way is simply writing it as [[179, x], [182, y]] while the other is to write it as a multi-polygon. There is a plan to support multi-polygons but it has not yet been implemented.

NuGet

The project can be found on nuget.

Install

dotnet add package HaemmerElectronics.SeppPenner.GeoJsonCircleToPolygon

Change history

See the Changelog.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 is compatible.  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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.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.3 196 12/7/2023
1.0.2 122 11/13/2023
1.0.1 123 10/16/2023
1.0.0 116 10/14/2023

Version 1.0.3.0 (2023-12-07): Updated NuGet packages, Added support for Net8.0.