Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Earth InnerBoundary Nesting #4

Closed
DSchougaard opened this issue Jan 30, 2018 · 4 comments
Closed

Google Earth InnerBoundary Nesting #4

DSchougaard opened this issue Jan 30, 2018 · 4 comments

Comments

@DSchougaard
Copy link

It would appears as if Google Earth consequently "breaks" the written standard for a Polygon with multiple InnerBoundaries.

Instead of having:

  • Polygon
    • InnerBoundary
      • LinearRing
        • Coordinates
    • InnerBoundary
      • LinearRing
        • Coordinates

They serialize it as:

  • Polygon
    • InnerBoundary
      • LinearRing
        • Coordinates
      • LinearRing
        • Coordinates

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.

@samcragg
Copy link
Owner

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.

@DSchougaard
Copy link
Author

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.

@DSchougaard
Copy link
Author

Wouldn't it rather be Polygon which would need to override AddChild? Overriding AddChild in InnerBoundary, still results in its parent being null.

@samcragg
Copy link
Owner

samcragg commented Feb 4, 2018

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.

@samcragg samcragg closed this as completed Feb 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants