Closed DSchougaard closed 6 years ago
Checking the schema (in both 2.2 and 2.3) and there should only be one LinearRing, so it's odd it's choosing to serialize it like that.
My initial thoughts are to make Element.AddChild
virtual so that InnerBoundary
can override it and if it already has a LinearRing
set it could add a new InnerBoundary
to the Parent
.
I'll see if I have time over the weekend to look at it.
It is a weird way to serialize it. I tried forcing the KML to contain multiple InnerBoundaries instead, loading it into Google Earth, and finally re-saving it. It consistently goes against the specs.
I was looking at using the set'er for the LinearRing, but I ran into the problem that the InnerBoundary did not know its parent at the given time.
Wouldn't it rather be Polygon
which would need to override AddChild
? Overriding AddChild
in InnerBoundary
, still results in its parent being null.
That should be fixed now in version 3.0.2.
You were right about the parent not being set - I divided element creation and population into two separate steps now so that the change was easier to implement.
I added a unit test that hopefully shows the original problem, but if you have any issues let me know and I'll take another look at it.
It would appears as if Google Earth consequently "breaks" the written standard for a Polygon with multiple InnerBoundaries.
Instead of having:
They serialize it as:
When parsing such a file with SharpKML, only the last InnerBoundary is attached to the Polygon.
Suggestion: Add the feature of parsing such a Google Earth file, but convert it to valid KML 2.2 notation, with multiple InnerBoundaries instead.