Select to view content in your preferred language

KML Layer and new line

4980
1
03-08-2012 06:37 AM
SylvainKerdreux
Emerging Contributor
I Create a small KML file :

<kml xmlns="http://earth.google.com/kml/2.1">
  <Document>
    <name>KML Name</name>
    <description>KML Description</description>
    <Placemark>
         <name>Trinity College</name>
         <description>
             Trinity College...
            <br/>
            link : <a href="http://www.tcd.ie/visitors/">http://www.tcd.ie/visitors/</a><br/><br/>
            Price : none <br/><br/>
         </description>
         <Point>
            <coordinates>-6.25884, 53.3445</coordinates>
         </Point>
    </Placemark>
  </Document>
</kml>



Using google earth, html markup <br/> display new line.
However using kml layer with arcgis API, it does not add new line but it does not display markup.
here the code to add my kml layer :
  var kmlUrl = 'http://myLocalServer/data.kml';
  kml = new esri.layers.KMLLayer(kmlUrl);
  map.addLayer(kml);  


I also try \n but it only display \n when I click on my feature.

so how to add new line into description markup ?

Sylvain.
0 Kudos
1 Reply
derekswingley1
Deactivated User
I'm seeing <br /> converted to \n which causes a newline:  http://jsfiddle.net/nP5wy/ (you'll have to pan to see the point).

Take a look at the response from the KML service on arcgis.com:  http://utility.arcgis.com/sharing/kml?url=http%3A%2F%2Fdl.dropbox.com%2Fu%2F2654618%2Fkml%2Fkml_newl...

You will see that there are \n characters in the feature's description property.
0 Kudos