MicrosoftSpatialGeoJsonConverter doesn't support Microsoft.Spatial.GeographyPolygon
See original GitHub issueTrue {“type”:“Point”,“coordinates”:[20.1,20]} False
is the LinqPad output for the code below. MicrosoftSpatialGeoJsonConverter seems to be handling Point, why not Polygon?
void Main()
{
GeographyPoint geographyPoint = GeographyPoint.Create(20, 20.1);
GeographyPolygon geographyPolygon = GeographyFactory.Polygon().Ring(10, 10).LineTo(30, 10).LineTo(30, 30).LineTo(10, 30).LineTo(10, 10).Build();
WriteObject(geographyPoint);
WriteObject(geographyPolygon);
}
void WriteObject(object obj)
{
MicrosoftSpatialGeoJsonConverter converter = new ();
converter.CanConvert(obj.GetType()).Dump();
JsonWriterOptions writerOptions = new () { Indented = false, };
using MemoryStream stream = new ();
using Utf8JsonWriter writer = new (stream, writerOptions);
JsonSerializerOptions options = new (JsonSerializerDefaults.General);
converter.Write(writer, obj, options);
writer.Flush();
string json = Encoding.UTF8.GetString(stream.ToArray());
json.Dump();
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
Returning spatial data in GeoJSON format - Part 2
In this post I will show you how to export other spatial types such as lines or polygons, into equivalent GeoJSON formats. Spatial...
Read more >Using Microsoft Footprint GeoJSON for spatial analysis ...
I am trying to use the Microsoft Footprint data (available as GeoJSON) for spatial analysis to roughly identify buildings over a certain size ......
Read more >System.Text.Json support for Microsoft.Spatial library for .NET
Spatial package contains classes and methods that support geographic operations. This library contains converters dependent on System.Text.
Read more >convert geoJson data to sql server spatial data type (GIS)
I'm trying to store the json data related to the polygons in my ms sql server using spatial data. Since I've never parsed...
Read more >Converting GeoJSON to DbGeometry - bing maps
Note that DbGeometery will not support spatially accurate calculations. Consider storing the data as a DbGeograpgy instead using geography:: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sure, I’ll work on that tonight. Thanks.
Great! Thanks so much for the feedback and beta publish.