• Stars
    star
    111
  • Rank 314,510 (Top 7 %)
  • Language
    C#
  • License
    BSD 3-Clause "New...
  • Created about 7 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

GeoJSON IO module for NTS.

GeoJSON

GeoJSON (RFC 7946) IO module for NTS.

GeoJSON4STJ Usage

This is the package for System.Text.Json serialization and deserialization.

ASP.NET Core Example

Add the System.Text.Json.Serializer.JsonConverterFactory, GeoJsonConverterFactory, to the JsonSerializerOptions when you configure your controllers, MVC, etc in the ConfigureServices method of your Startup.cs class.

public void ConfigureServices(IServiceCollection services) {
  services.AddControllers()
  .AddJsonOptions(options => {
    options.JsonSerializerOptions.Converters.Add(new NetTopologySuite.IO.Converters.GeoJsonConverterFactory());
  });
}

GeoJSON Usage

GeoJSON to Geometry:

var geoJson = "{\"type\":\"Point\",\"coordinates\":[0.0,0.0]}";
Geometry geometry;

var serializer = GeoJsonSerializer.Create();
using (var stringReader = new StringReader(geoJson))
using (var jsonReader = new JsonTextReader(stringReader))
{
    geometry = serializer.Deserialize<Geometry>(jsonReader);
}

Geometry to GeoJSON:

var geometry = new Point(0, 0);
string geoJson;

var serializer = GeoJsonSerializer.Create();
using (var stringWriter = new StringWriter())
using (var jsonWriter = new JsonTextWriter(stringWriter))
{
    serializer.Serialize(jsonWriter, geometry);
    geoJson = stringWriter.ToString();
}

More Repositories

1

NetTopologySuite

A .NET GIS solution that is fast and reliable for the .NET platform.
C#
1,438
star
2

ProjNet4GeoAPI

.NET Spatial Reference and Projection Engine
C#
273
star
3

GeoAPI

GeoAPI.NET project provides a common framework based on OGC/ISO standards to improve interoperability among .NET GIS projects.
C#
159
star
4

PowerCollections

PowerCollections
C#
47
star
5

NetTopologySuite.IO.Esri

C#
35
star
6

NetTopologySuite.IO.ShapeFile

The ShapeFile IO module for NTS.
C#
34
star
7

NetTopologySuite.IO.VectorTiles

A package that can be used to generate vector tiles using NTS.
C#
19
star
8

NetTopologySuite.IO.SqlServerBytes

A SQL Server IO module for NTS which works directly with the serialization format
C#
16
star
9

NetTopologySuite.IO.PostGis

PostGis IO module for NTS.
C#
12
star
10

NetTopologySuite.IO.GPX

GPX I/O for NetTopologySuite
C#
10
star
11

NetTopologySuite.IO.SpatiaLite

SpatialLite IO module for NTS.
C#
7
star
12

NetTopologySuite.Features

An implementation of Feature and FeatureCollection
C#
7
star
13

NetTopologySuite.Windows

Windows-specific NTS modules (WPF & Winforms)
C#
5
star
14

NetTopologySuite.IO.TinyWKB

NetTopologySuite IO project to read and write geometry in Tiny Well-Known-Binary fromat
C#
4
star
15

NetTopologySuite.Curve

Enhancement for NetToplogySuite that handles Curved geometries
C#
3
star
16

NetTopologySuite.IO.SqlServer2008

The SQLServer IO Module.
C#
2
star
17

NetTopologySuite.IO.MsSqlSpatial

The MS Sql Spatial IO module.
C#
1
star
18

NetTopologySuite.IO.TopoJSON

TopoJSON IO module for NTS.
C#
1
star
19

migration

Contains scripts and info on the migration of NTS to github.
Shell
1
star
20

NetTopologySuite.Geography

Geography types for NetTopologySuite.
C#
1
star
21

NetTopologySuite.DotSpatial

The NTS module to interact with DotSpatial.
C#
1
star