Skip to main content
Question

How can I change the colors for a KML line when it is rolledover or selected?

  • February 18, 2016
  • 4 replies
  • 50 views

I have some route geometry that I am trying to highlight when it is selected or rolled over. I think that I should use the KML styler but I am not sure how to proceed.

4 replies

erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • February 18, 2016

From your (short) description I would think you need a some sort of test for selected routes (Tester or TestFilter) and attach different KMLStylers to the output ports of the test transfomer. That way you can style different selections in a different way.

Instead of the KMLStyler you could also use the FeatureColorSetter transformer if color is the only styling option you need.


  • Author
  • February 18, 2016
erik_jan wrote:

From your (short) description I would think you need a some sort of test for selected routes (Tester or TestFilter) and attach different KMLStylers to the output ports of the test transfomer. That way you can style different selections in a different way.

Instead of the KMLStyler you could also use the FeatureColorSetter transformer if color is the only styling option you need.

It seems like the answer lies in something called style map?? OR.. in mapping a color to one of these exposed attributes. (see attached)feature-type-properties.png


mark2atsafe
Safer
Forum|alt.badge.img+43
  • Safer
  • February 19, 2016
jscrivens wrote:

It seems like the answer lies in something called style map?? OR.. in mapping a color to one of these exposed attributes. (see attached)feature-type-properties.png

Yes, style map. I have the info somewhere I'm sure. Let me see what I can find.


mark2atsafe
Safer
Forum|alt.badge.img+43
  • Safer
  • February 19, 2016

OK, a fairly quick process, and not really difficult. I created a demo for you.

The workspace and data are here: https://www.dropbox.com/s/g9z6c93yvpvtc3k/KMLHighl...

I recorded creating the workspace and the video is here: http://screencast.com/t/4pZr5wX0oL

There's also an article in our knowledgebase: https://knowledge.safe.com/articles/869/highlight...

To document the process:

1) You create a single feature and style it with the KMLStyler. You give it a kml_id attribute with a value like normal_style

2) You create a single feature and style it with the KMLStyler. You give it a kml_id attribute with a value like highlight_style

3) You write these to a feature type called Style

4) The data you want to style you give an attribute kml_target_style_normal (with a value of normal_style - i.e. what you set the style kml_id to). You also give it an attribute kml_target_style_highlight (with a value of highlight_style).

5) If your data has existing colors, expose and remove the FME attributes fme_color and fme_fill_color

6) Run the workspace! You'll find that your data has the normal style, but when you mouseover it, it will get the highlighted style


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings