|
1 | | -# GeoJSON.NET |
2 | 1 | [](https://www.nuget.org/packages/GeoJSON.NET/) |
3 | | - |
4 | 2 | [](https://ci.appveyor.com/project/matt-lethargic/geojson-net) |
5 | 3 |
|
| 4 | +# GeoJSON.NET |
6 | 5 | GeoJSON.Net is a .NET library for the [RFC 7946 The GeoJSON Format](https://tools.ietf.org/html/rfc7946) and it uses and provides [Newtonsoft Json.NET](http://json.codeplex.com) converters for serialization and deserialization of GeoJSON data. |
7 | 6 |
|
8 | 7 |
|
9 | 8 | ## Installation & Usage |
10 | | -Well all you basically have to do is install the [GeoJSON.Net](https://www.nuget.org/packages/GeoJSON.Net/) NuGet package: |
11 | 9 |
|
12 | | -`PM> Install-Package GeoJSON.Net` |
| 10 | +[GeoJSON.Net NuGet package](https://www.nuget.org/packages/GeoJSON.Net/): |
| 11 | +`Install-Package GeoJSON.Net.Contrib.MsSqlSpatial` |
13 | 12 |
|
14 | | -To deserialize a json string: |
| 13 | +### Serialization |
15 | 14 |
|
16 | | -`var geoJsonObject = JsonConvert.DeserializeObject<Point>(json);` |
| 15 | +```csharp |
| 16 | +Position position = new Position(51.899523, -2.124156); |
| 17 | +Point point = new Point(position); |
17 | 18 |
|
18 | | -That's all there is. Really. From there on you can go ahead and (De-)Serialize GeoJSON using the provided [converters](https://github.com/GeoJSON-Net/GeoJSON.Net/tree/master/src/GeoJSON.Net/Converters) - see [the Tests for example usage](https://github.com/GeoJSON-Net/GeoJSON.Net/tree/master/src/GeoJSON.Net.Tests). |
| 19 | +string json = JsonConvert.SerializeObject(point); |
| 20 | +``` |
19 | 21 |
|
| 22 | +### Deserialization |
20 | 23 |
|
21 | | -## News |
22 | | -It's probably best to check out the [commits](https://github.com/GeoJSON-Net/GeoJSON.Net/commits/master) and the [issues](https://github.com/GeoJSON-Net/GeoJSON.Net/issues) what has been added over time. |
| 24 | +```csharp |
| 25 | +string json = "{\"coordinates\":[-2.124156,51.899523],\"type\":\"Point\"}"; |
23 | 26 |
|
24 | | -## Contributing |
25 | | -Highly welcome! Just fork away and send a pull request. |
| 27 | +Point point = JsonConvert.DeserializeObject<Point>(json); |
| 28 | +``` |
26 | 29 |
|
| 30 | +See the [Tests](https://github.com/GeoJSON-Net/GeoJSON.Net/tree/master/src/GeoJSON.Net.Tests) for more examples. |
27 | 31 |
|
28 | | -## Thanks |
29 | | -This library would be NOTHING without its [contributors](https://github.com/GeoJSON-Net/GeoJSON.Net/graphs/contributors) - thanks so much!! |
30 | 32 |
|
31 | | -## Copyright |
32 | | - |
33 | | -Copyright © 2017 Jörg Battermann & [Contributors](https://github.com/GeoJSON-Net/GeoJSON.Net/graphs/contributors) |
34 | | - |
35 | | -## License |
| 33 | +## News |
| 34 | +It's probably best to check out the [commits](https://github.com/GeoJSON-Net/GeoJSON.Net/commits/master) |
| 35 | +and the [issues](https://github.com/GeoJSON-Net/GeoJSON.Net/issues) what has been added over time. |
36 | 36 |
|
37 | | -GeoJSON.Net is licensed under [MIT](http://www.opensource.org/licenses/mit-license.php "Read more about the MIT license form"). Refer to [LICENSE.md](https://github.com/GeoJSON-Net/GeoJSON.Net/blob/master/LICENSE.md) for more information. |
| 37 | +## Contributing |
| 38 | +Highly welcome! Just fork away and send a pull request. We try and review most pull requests within a couple of days. |
38 | 39 |
|
| 40 | +## Thanks |
| 41 | +This library would be NOTHING without its [contributors](https://github.com/GeoJSON-Net/GeoJSON.Net/graphs/contributors) - thanks so much!! |
0 commit comments