Skip to content

Commit

Permalink
Change to MultiPolygon with empty Polygon
Browse files Browse the repository at this point in the history
  • Loading branch information
dickinsonm committed Apr 30, 2024
1 parent 9af1dac commit 1b4d263
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static StjParsedCoordinates Parse(ref Utf8JsonReader reader, GeometryFact
reader.ReadOrThrow();
if (reader.TokenType == JsonTokenType.EndArray)
{
return default;
return new StjParsedCoordinates(factory.CreateMultiPolygon(new Polygon[] { factory.CreatePolygon() }));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ public void TestReadWithEmptyCoordinatesArray(string type)
Assert.That(geom.IsEmpty);
}


[TestCase("MultiPolygon")]
public void TestReadWithArrayOfEmptyCoordinatesArray(string type)
[TestCase]
public void TestMultiPolygonReadWithArrayOfEmptyCoordinatesArray()
{
string geoJson = @$"{{ ""type"" : ""{type}"", ""coordinates"": [ [] ] }}";
string geoJson = @"{ ""type"" : ""MultiPolygon"", ""coordinates"": [ [] ] }";
var options = DefaultOptions;
var geom = Deserialize(geoJson, options);

Assert.That(geom != null);
Assert.That(new MultiPolygon(new Polygon[] { new Polygon(null) }) == geom);
Assert.That(geom.IsEmpty);
}

Expand Down

0 comments on commit 1b4d263

Please sign in to comment.