0
votes

I have a KML file which used to display correctly in both Google Maps and Google Earth. Now Google Maps rejects the file, while Earth still accepts it and displays the content. Here is the file:

http://www.skiforeningen.no/marka/kml/milorg.kml

The Galdos Validator at http://www.kmlvalidator.com/ indicates the following error on line 19:

cvc-complex-type.2.4.a: Invalid content was found starting with element 'IconStyle'. One of '{"http://www.opengis.net/kml/2.2":PolyStyle, "http://www.opengis.net/kml/2.2":BalloonStyle, "http://www.opengis.net/kml/2.2":ListStyle, "http://www.opengis.net/kml/2.2":StyleSimpleExtensionGroup, "http://www.opengis.net/kml/2.2":StyleObjectExtensionGroup}' is expected.

But when reading the documentation at

https://developers.google.com/kml/documentation/kmlreference#style

I can't see why IconStyle is not allowed her? Also, the validator at http://feedvalidator.org/ validates the file with no errors and says it is a valid KML 2.2 feed.

Any help will be highly appreciated, thanks.

2

2 Answers

0
votes

http://feedvalidator.org/ says your KML is valid.

KML content isn't available in Google Maps anymore.

From the link above:

While using Google Maps, you might have received a notification saying "Some custom on-map content could not be displayed."

That’s because a certain type of content isn’t available anymore in the classic version of Google Maps or in maps embedded on other websites from the classic version of Maps. The content type that’s no longer available is KML, the file format Google Earth uses for the exchange of geographic information.

If you're the owner of a custom map with KML content, you need to update your content. Or, you can import your KML content into My Maps.

One workaround: It works with the Google Maps Javascript API v3 KmlLayer

0
votes

The KML is not valid with respect to the KML XML schema so the validator errors are correct. Order of elements in KML is strict. Google Earth in most cases ignores the order of elements.

Your KML has style structured like this:

  <Style id="MILORG1">
    <LineStyle>
    ...
    </LineStyle>

    <IconStyle>
    ...
    </IconStyle>

    <BalloonStyle>
    </BalloonStyle>
  </Style>

But the correct sequence of elements in Style element is as follows:

  <IconStyle>...</IconStyle>
  <LabelStyle>...</LabelStyle>
  <LineStyle>...</LineStyle>
  <PolyStyle>...</PolyStyle>
  <BalloonStyle>...</BalloonStyle>
  <ListStyle>...</ListStyle>

Simply reorder your elements to conform to the KML specification. IconStyle must appear before LineStyle in the list.