项目作者: GeoJSON-Net

项目描述 :
Repository for all GeoJSON.Net *.Contrib projects
高级语言: C#
项目地址: git://github.com/GeoJSON-Net/GeoJSON.Net.Contrib.git
创建时间: 2015-03-15T21:16:18Z
项目社区:https://github.com/GeoJSON-Net/GeoJSON.Net.Contrib

开源协议:MIT License

下载


NuGet Version
NuGet Version
NuGet Version
Build status

GeoJSON.Net.Contrib

Repository for all GeoJSON.Net *.Contrib projects

GeoJSON.Net.Contrib.MsSqlSpatial

Allows conversion from / to Microsoft Sql Server geometry and geography data types.

NuGet package:
Install-Package GeoJSON.Net.Contrib.MsSqlSpatial

Conversion examples:

  1. using GeoJSON.Net.Geometry;
  2. using Microsoft.SqlServer.Types;
  3. using GeoJSON.Net.Contrib.MsSqlSpatial;
  4. // SqlGeometry sample point
  5. SqlGeometry simplePoint = SqlGeometry.Point(1, 47, 4326);
  6. // SqlGeometry -> GeoJSON example
  7. Point point = simplePoint.ToGeoJSONObject<Point>();
  8. // GeoJSON -> SqlGeometry example
  9. SqlGeometry sqlPoint = point.ToSqlGeometry(4326);

WKT conversion examples:

  1. using GeoJSON.Net.Contrib.MsSqlSpatial;
  2. using GeoJSON.Net.Geometry;
  3. // LineString from WKT
  4. LineString lineString = WktConvert.GeoJSONObject<LineString>("LINESTRING(1 47,1 46,0 46,0 47,1 47)");
  5. // LineString IGeometryObject from WKT
  6. IGeometryObject lineStringGeom = WktConvert.GeoJSONGeometry("LINESTRING(1 47,1 46,0 46,0 47,1 47)");

GeoJSON.Net.Contrib.EntityFramework

Allows conversion from / to EntityFramework geometry and geography data types.

NuGet package:
Install-Package GeoJSON.Net.Contrib.EntityFramework

Conversion examples:

  1. using GeoJSON.Net.Geometry;
  2. using GeoJSON.Net.Contrib.EntityFramework;
  3. // DbGeography sample point
  4. var dbGeographyPoint = DbGeography.FromText("POINT(30 10)", 4326);
  5. // DbGeography -> GeoJSON example
  6. Point point = dbGeographyPoint.ToGeoJSONObject<Point>();
  7. // GeoJSON -> DbGeography example
  8. DbGeography dbGeographyPoint = point.ToDbGeography();

GeoJSON.Net.Contrib.Wkb

Allows conversion from / to Wkb binary types. Only X,Y,Z coordinates are supported, attempting to convert a geometry with M coordinates will throw an Exception.

NuGet package:
Install-Package GeoJSON.Net.Contrib.Wkb

Conversion examples:

  1. using GeoJSON.Net.Geometry;
  2. using GeoJSON.Net.Contrib.Wkb;
  3. // GeoJson sample point
  4. Point point = new Point(new Position(53.2455662, 90.65464646));
  5. // GeoJson -> Wkb example
  6. byte[] wkbPoint = point.ToWkb();
  7. // Wkb -> GeoJson example
  8. Point pointFromWkb = wkbPoint.ToGeoJSONObject<Point>();

Contribution Guide

Development Environment

Build, test and package the solution

Use shell of your choice (cmd.exe, powershell.exe, pwsh, bash, etc) to run the following commands:

  1. # verify .NET SDK
  2. dotnet --info
  3. # => .NET Core SDK (reflecting any global.json):
  4. # => Version: 3.1.301
  5. # => ...
  6. # download repository
  7. cd <development-directory-root>
  8. git clone https://github.com/GeoJSON-Net/GeoJSON.Net.Contrib.git
  9. cd GeoJSON.Net.Contrib
  10. # build ("Debug" configuration)
  11. dotnet build src/GeoJSON.Net.Contrib.sln
  12. # test ("Debug" configuration)
  13. dotnet test src/GeoJSON.Net.Contrib.sln
  14. # package ("Release" configuration)
  15. git clean -dfx
  16. dotnet pack --configuration Release src/GeoJSON.Net.Contrib.sln
  17. # push all projects to NuGet server (requires "package" step above to be run first)
  18. # note: in addition to ".nupkg", the command below will automatically
  19. # detect ".snupkg" symbol package and push both ".nupkg" and ".snupkg"
  20. # to the specified NuGet server; for more information see
  21. # https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg
  22. dotnet nuget push **/*.nupkg --api-key SECRET --source https://api.nuget.org/v3/index.json