KMLLayer Style support

3135
2
Jump to solution
07-10-2013 03:22 PM
CorySmith2
New Contributor II
I am displaying points from a KML file on my Javascript API map using esri.layers.KMLLayer().  The Placemarks in my KML file have a styleUrl defined as:
   <Style id="myStyle">       <LabelStyle>          <color>FFCCFFCC</color>       </LabelStyle>       <IconStyle>          <color>FF3F3FFF</color>          <Icon><href>http://mydomain.com/marker.png</href></Icon>       </IconStyle>    </Style>

The map is displaying my points using the marker.png as defined in this style, but I have two issues:

  1. Labels are not displayed.  I would like to display the Placemark's name as a label (ie always visible).

  2. The markers are the default color of the image (white).  I would like to marker to use the <color> in the <IconStyle>.

Is possible to do either of these?  Thanks!
0 Kudos
1 Solution

Accepted Solutions
CorySmith2
New Contributor II
A follow up to my own question, if anyone else wants more control over their KML rendering...

I was not able to get the functionality I wanted using the KMLLayer.  Instead, I decided to load the KML file using jQuery's ajax function. Then for each placemark I built a PictureMarkerSymbol and TextSymbol and added them to the map. 

A bit more javascript than I was hoping for, but in the end it gave me much greater control over my map symbols.

View solution in original post

0 Kudos
2 Replies
CorySmith2
New Contributor II
A follow up to my own question, if anyone else wants more control over their KML rendering...

I was not able to get the functionality I wanted using the KMLLayer.  Instead, I decided to load the KML file using jQuery's ajax function. Then for each placemark I built a PictureMarkerSymbol and TextSymbol and added them to the map. 

A bit more javascript than I was hoping for, but in the end it gave me much greater control over my map symbols.
0 Kudos
EvanLevy
New Contributor

Could you post your code of how you did the jQuery method please?

I currently am trying to use KML links in my ArcGIS Javascript application but some symbology is not drawing correctly.  I also am curious about how the kml layer differs from a feature layer - are you able to perform analysis using the KML layers?  For example, if I had a line feature layer and I want to have a process that selects all line features that are within a distance of the KML Layer.  Also how do I go about adding my KML Layer into my legend?  I have not seemed to figure out how to do that.

0 Kudos