Question

Setting the color of lines and points using an attribute value as input for color to KMLStyler

  • 18 June 2019
  • 4 replies
  • 53 views

Badge +1

I have a set of polyline features and a set of point features in a ShapeFile. Each set of features has a RID field. The RID for a polyline record corresponds to an RID field for the points. As expected, one line has many points that comprise it. There are 10-20 lines in the input dataset and ~1500 points. I just want to show each unique RID value as a different color in my output KML file. The workbench goes something like this:

1) Read the Lines and the Points

2) Read a SQLite DB containing a table listing a RID, and a Color (both RGB 100,100,100 and KMLColor FF00987F format (http://www.zonums.com/gmaps/kml_color/)

3) FEature Merger moves the attributes from the SQL Lite DB to the Shapefiles, the reprojector, 3dforcer, KMLPropertySetter then the KMLStyler where the colors for all symbology is set using the fields containing the colors merged from the SQL lite databases.

4) The resulting data is written out to the KMZ.

The issue is that neither the RGB or the KML Color values are applied to the outgoing features. One or two of the lines show up in RED, the remainder show up as plain black lines. I want features with RID=1 to be red, RID=2 to be yellow, etc.

I'm using FME 2019.0.2.0 - 20190605 Build 19260 MacOX, 64=bit.

Thanks,

@pcgveenstra


4 replies

Userlevel 1
Badge +10

I think the attribute you reference in the kml styler needs to be the fme colour, so red would be 1,0,0 yellow 1,1,0 etc.

Badge +3

I think @egomm might be on the money!

But before I'd read her answer, I thought it may have something to do with having to create aggregates of your point geometries onto their parent line geometries, as explained in this tutorial: https://knowledge.safe.com/articles/898/how-do-i-label-google-earth-polygons.html

Badge +1

The suggestion of using FME Colors ranging from 0-1 for each RGB element (0.5,0.5,1) worked like a charm. Thanks @egomm.

Badge +1

The suggestion of using FME Colors ranging from 0-1 for each RGB element (0.5,0.5,1) worked like a charm. Thanks @egomm.

 

One thing to remember - since this is trying to export a 'unique' color for each unique polyline and associated points - make sure the "Allow Unique Styles per Feature" option is set to "Yes".

Reply