Hi,
I have seen a few examples here on how to make a line or a point in a kml file change style when you hover over it, can you do the same with a polygon? I couldn't find any examples of doing this with a polygon.
Hi,
I have seen a few examples here on how to make a line or a point in a kml file change style when you hover over it, can you do the same with a polygon? I couldn't find any examples of doing this with a polygon.
I have never done that with polygons, but I bet the concept is the same as with the other geometries.
Add a Creator to create one feature. Join it with a KMLStyler and create the normal style. After that, create the "kml_id" attribute for that feature and give it a name like "normal_style" or whatever you like.
Add another Creator to create a single feature. Join it with a KMLStyler and create the hover style. Give it a unique "kml_id" like "hover_style".
Add a third Creator and join it with an AttributeCreator. You need to create three new attributes for that feature:
Add your KML Writer. In that Writer create the Style feature type. You have to expose the "kml_id" in the Format Attributes tab of that feature type. You have to join the first two features created to this feature type.
Add another feature type to the same writer. In this case is called StyleMap. In the Format Attributes tab of that feature type yo need to expose "kml_id", "kml_style_url_normal" and "kml_style_url_highlight". You have to join the third feature created to this feature type.
Then you read your source polygons and with an AttributeManager or similar you have to create the attribute "kml_style_url" with the value "#feature_styles" (or the name you have chosen with the .
Add a thrid feature type to your KML Writer. This time you use the name you want. You need to expose the "kml_style_url" in the Format Attributes of that new feature type. Join the polygons with that feature type and run it.
This is way more simple visually, so I will try to make time later this day to build a workspace to share with you.
Here you have a workspace showing how to apply what I have mentioned before.
Here you have a workspace showing how to apply what I have mentioned before.
Thank you for your explanation and example, will see what i can come up with.
Here you have a workspace showing how to apply what I have mentioned before.
I have been playing around with your workspace and have got the kml file pretty much how i want it , but still can't get the highlight to work, could you have a look at the attached template and point out what i need to do please? Also how would i put a colour around the border of the balloon. The attached image is of a balloon i created using mapbasic, i am trying to do similar in FME.
I have been playing around with your workspace and have got the kml file pretty much how i want it , but still can't get the highlight to work, could you have a look at the attached template and point out what i need to do please? Also how would i put a colour around the border of the balloon. The attached image is of a balloon i created using mapbasic, i am trying to do similar in FME.
A couple of issues:
The kml_style_url value has to be "#feature_styles".
Another problem was that your source polygons already had a colour defined and it seems the KMLStyler can't override them. I have expose fme_color and fme_fill_color and delete them. I find that a bit weird. Could that be a bug?
About that other question you have with the colour of the balloon I have never done anything like that. I have checked and there is a property called kml_balloon_color. I would try setting a value for that in your AttributeCreator_3 and see what happens. There is also a kml_balloonstyle_bgcolor.
I have been playing around with your workspace and have got the kml file pretty much how i want it , but still can't get the highlight to work, could you have a look at the attached template and point out what i need to do please? Also how would i put a colour around the border of the balloon. The attached image is of a balloon i created using mapbasic, i am trying to do similar in FME.
Thanks, I thought you would be able to override the existing colour of the polygons when you set the new style, will remember that for future use.