-1

I am trying to display custom info from a KML file onto google maps. I am using this tutorial and for the most part it is working. I however cannot seem to add an address after then name in the BallonStyle. The code I am using is below.

Any help is appreciated

<BalloonStyle>
    <text><![CDATA[<h3>$[name], $[address]</h3>]]></text>
</BalloonStyle>

<name>Untitled layer</name>
  <Placemark>
    <name>Campus Honda</name>
<address>506 Finlayson St, Victoria, BC V8T 5C8</address>
    <styleUrl>#icon-1899-0288D1-nodesc</styleUrl>


<Point>
      <coordinates>
        -123.3737904,48.4445293,0
      </coordinates>
    </Point>
  </Placemark>
Scubadivingfool
  • 1,227
  • 2
  • 10
  • 23

1 Answers1

0

See the documentation, the Google Maps API KmlLayer doesn't support entity replacements.

<BalloonStyle> partially only <text> is supported

<ExtendedData> partially untyped <Data> only, no <SimpleData> or <Schema>, and entity replacements of the form $[dataName] are not supported.

You could try the 3rd party KML parser geoxml3 (or an equivalent).

Related question: GeoXML3 accessing KML attribute datas.

But that may have performance issues with large/complex KML.

(disclaimer: I currently maintain geoxml3, although there isn't much activity there)

Community
  • 1
  • 1
geocodezip
  • 158,664
  • 13
  • 220
  • 245