Trying to return some pretty simple GeoJSON data. I found NetTopologySuite and installed a simple FeatureCollection and tried to serialize it to a GeoJson string only to get the following error:
"The referencing cell found for the" CoordinateValue "property with type 'GeoAPI.Geometries.Coordinate'. Feature Track [0] .Geometry.Coordinates [0]."
Looking through class headers, Point uses Coordinate, which has the Coordinate property, so I can understand why there will be a circular reference. The thing is, most (if not all) geometries seem to use Point, so that would make it impossible to ever serialize anything ... if I didn't miss something.
So is this a mistake or am I missing something?
Tested only by a point and received the same error, so here is the code for this:
using NTS = NetTopologySuite; var ret = new NTS.Geometries.Point(42.9074, -78.7911); var jsonSerializer = NTS.IO.GeoJsonSerializer.Create(); var sw = new System.IO.StringWriter(); jsonSerializer.Serialize(sw, ret); var json = sw.ToString();
source share