Here's a screenshot of my workbench. It reads a large GDB (not shown) containing 7.5million points and fans them out into 500+ KMZs, one for each UK Postcode District. The screenshot below has only read the first 10000 records, and created 3 KMZs. Each point is colored red, amber, yellow or green depending on a ModelRiskLevel parameter.
I think I may have cracked it. The trick is to have two Creator transformers: one creating the Styles using the KMLStyler transformer, and one creating the different StyleMaps using the kml_target_style_* attributes in an AttributeCreator. All outputs are then routed to a Styles.kmz
The big advantage of this approach is that if a user wants to have the styles changed (e.g. larger icons, different colors, labels switched on, etc.), all I'd need to do is send him a new 1kB Styles.kmz file (or the user can even manually edit it herself).
In the main workspace that creates all my 500+ KMZs, all I need is an AttributeCreator or AttributeManager and set
kml_style_url = Styles.kmz#myStyle@Value(ModelRiskLevel)_myStyleHighlight
See attached workspace createstyleskmz.fmwt and screenshot referencetostylefile.png
I think I may have cracked it. The trick is to have two Creator transformers: one creating the Styles using the KMLStyler transformer, and one creating the different StyleMaps using the kml_target_style_* attributes in an AttributeCreator. All outputs are then routed to a Styles.kmz
The big advantage of this approach is that if a user wants to have the styles changed (e.g. larger icons, different colors, labels switched on, etc.), all I'd need to do is send him a new 1kB Styles.kmz file (or the user can even manually edit it herself).
In the main workspace that creates all my 500+ KMZs, all I need is an AttributeCreator or AttributeManager and set
kml_style_url = Styles.kmz#myStyle@Value(ModelRiskLevel)_myStyleHighlight
See attached workspace createstyleskmz.fmwt and screenshot referencetostylefile.png
Good question - and great answer.
Good question - and great answer.
Thanks Mark. And the workspace looks a lot better with the new Junction transformer.
I think I may have cracked it. The trick is to have two Creator transformers: one creating the Styles using the KMLStyler transformer, and one creating the different StyleMaps using the kml_target_style_* attributes in an AttributeCreator. All outputs are then routed to a Styles.kmz
The big advantage of this approach is that if a user wants to have the styles changed (e.g. larger icons, different colors, labels switched on, etc.), all I'd need to do is send him a new 1kB Styles.kmz file (or the user can even manually edit it herself).
In the main workspace that creates all my 500+ KMZs, all I need is an AttributeCreator or AttributeManager and set
kml_style_url = Styles.kmz#myStyle@Value(ModelRiskLevel)_myStyleHighlight
See attached workspace createstyleskmz.fmwt and screenshot referencetostylefile.png
Hi Arnold, if you are still following this solution , I am unable to get something like this to work. Do you have a small complete example you could share. I agree the documentation is lamentable for this.
Thanks,
Ian
I think I may have cracked it. The trick is to have two Creator transformers: one creating the Styles using the KMLStyler transformer, and one creating the different StyleMaps using the kml_target_style_* attributes in an AttributeCreator. All outputs are then routed to a Styles.kmz
The big advantage of this approach is that if a user wants to have the styles changed (e.g. larger icons, different colors, labels switched on, etc.), all I'd need to do is send him a new 1kB Styles.kmz file (or the user can even manually edit it herself).
In the main workspace that creates all my 500+ KMZs, all I need is an AttributeCreator or AttributeManager and set
kml_style_url = Styles.kmz#myStyle@Value(ModelRiskLevel)_myStyleHighlight
See attached workspace createstyleskmz.fmwt and screenshot referencetostylefile.png
@ian2016: not sure what else I can share. The attached template file shows how to create a separate .kmz file containing all the style definition. Four styles are defined: Very High (red circle), High (amber circle), Medium (yellow circle) and Low (green circle). It also contains a blue circle as the highlight style. Those defined four styles and the highlight style are then applies to the kml_target_style_normal and kml_target_style_highlight attributes.
I have attached the
styles.kmz file so you can look 'inside':
styles.kmz
To create a KMZ file that references this
styles.kmz, which is stored inside the same folder, you need the AttributeCreator as described in my answer.
There is also a bit about the balloon text, which has something to do with Extended Data and Simple Data. See
https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_ReadersWriters/WKBkml/Extended_Data.htm
I am happy to share the full workbench on an individual basis, but I don't want to publish it on here. Just email me on arnold.bijlsma@stantec.com.
Thanks for your help Arnold, as usually happens, I got your approach to work with an example of my own while waiting for a reply from you. I am not at all familiar with kml and have been going round in circles with examples with the styles in the same kml, so that was most of the problem - confusion. Concatenating text to reference inside other files seems a bit weird to me but hey , if that's the way it works.
If I were to produce a single kml how would I use the Style URL to reference the styles within the same file? just take of the file name part on the attribute creator?
Thanks for your help.
Ian
Thanks for your help Arnold, as usually happens, I got your approach to work with an example of my own while waiting for a reply from you. I am not at all familiar with kml and have been going round in circles with examples with the styles in the same kml, so that was most of the problem - confusion. Concatenating text to reference inside other files seems a bit weird to me but hey , if that's the way it works.
If I were to produce a single kml how would I use the Style URL to reference the styles within the same file? just take of the file name part on the attribute creator?
Thanks for your help.
Ian
If you only have a single KML/KMZ file, it doesn't make much sense to have a separate Styles file. In that case, it's much easier to define your styles inside that KML file by simply using the KMLStyler transformer.