Question

Symbolise Layers in HTML Report Generator / HTML Layouter

  • 13 April 2022
  • 3 replies
  • 13 views

Badge +9

I have a map that has 5 layers in it and want to have them all displayed using different symbology in the HTML Layouter but I can only define a single colour for the layer.

Is it possible to generate HTML output with a little more cartographic input for each incoming layer?

 

image 

image 

 


3 replies

Userlevel 3
Badge +16

You'll probably have to do it yourself in the code. Thankfully it's not too complicated. Some style information is here: https://developers.arcgis.com/esri-leaflet/styles-and-visualization/style-a-feature-layer/

But you can use a StringReplacer to replace the line controlling how FME styles it

style:{"color": "rgb(200,0,255)"}

with something like this, basically copying from esri's example

style: (feature) => {
let style = {
  color: null // no outline color
};
if (feature.properties.name === "73980") {style.color = "rgb(200,0,255)";}
else {style.color = "rgb(0,0,0)";}
return style;
}

Just using If statements to colour features differently. The feature.properties.name refers to the "name" attribute on the features, whatever that happens to be for your case.

 

Badge +9

Thanks @ctredinnick​ that is certainly a great option.

Userlevel 2
Badge +17

For those following this question, please vote up these ideas

AC Idea: HTMLReportGenerator Table Styling (safe.com)

AC Idea: htmlreportgenerator - allow for layer colour to be linked to attributes (safe.com)

AC Idea: HTMLReportGenerator improvement suggestions (safe.com)

Ideally the htmlreportgenerator content settings would allow the "Color Layer" to make use of conditional values so you can style different fme_feature_types for exampletransformers_with_color_conditional

Reply