Skip to main content

I'm working with roads data from an ArcSDE reader and trying to expose all measure values into an new attribute list using the MeasureExtractor transformer.

It's working great for roads that are continuous/have only one part [fme_geometry = fme_line]. However, when roads that have multiple parts [fme_geometry = fme_aggregate] pass through the MeasureExtractor instead of having a new _measures{} list exposed, there is only a new attribute, [fme_rejection_code = INVALID_GEOMETRY]. Can the MeasureExtractor be setup to handle these fme_aggregate features? If not, can anyone recommend an alternative workflow that would result with one feature having a single list of the combined measures for a multi part road? Thanks in advance for any insight or advice.Screenshots below of transformer settings and Inspector results. Using FME Desktop 2014.

Inspector - Single part road.

 

Inspector - Multi part road. No _measures{ } list created.

Hi @ecrobertson, once you decompose the multi-line into individual single-lines (parts) with the Deaggregator, you can extract measure values as a list for each part with the MeasureExtractor. Then, if you aggregate the parts to restore the original multi-line with the Aggregater setting the List Name parameter (e.g. "_list"), the measure lists will also be combined into a nested list, like "_list{}._measure{}".

If you want to store all the measure values into a simple list (not-nested list), maybe Python or Tcl scripting would be easy to convert the nested list to a simple list.


Thank you very much @takashi that approach worked great. 

To future developers who find this page, here is the workbench and python script I wrote:

0684Q00000ArLNfQAN.png

Python code to join measures from aggregated features. Could be used to join(concatenate) any fme list attributes after using an Aggregator. 

import fmeobjects

def processFeature(feature):
    combinedMeasures = s]
    
    #Get number of segments for the line (set from Aggregator)
    partCount = feature.getAttribute("_partCount") 

    #Loop for each segment of line
    for x in xrange(0, partCount):  
        
        #Create a string for current index in _part list
        partStr = "_part{" + str(x) + "}._measures{}" 

        #Append list of current measures
        combinedMeasures += feature.getAttribute(partStr) 

    #Set new attribute with the combined measures of each road segment
    feature.setAttribute("_combinedMeasures", combinedMeasures) 


Thank you very much @takashi that approach worked great. 

To future developers who find this page, here is the workbench and python script I wrote:

0684Q00000ArLNfQAN.png

Python code to join measures from aggregated features. Could be used to join(concatenate) any fme list attributes after using an Aggregator. 

import fmeobjects

def processFeature(feature):
    combinedMeasures = s]
    
    #Get number of segments for the line (set from Aggregator)
    partCount = feature.getAttribute("_partCount") 

    #Loop for each segment of line
    for x in xrange(0, partCount):  
        
        #Create a string for current index in _part list
        partStr = "_part{" + str(x) + "}._measures{}" 

        #Append list of current measures
        combinedMeasures += feature.getAttribute(partStr) 

    #Set new attribute with the combined measures of each road segment
    feature.setAttribute("_combinedMeasures", combinedMeasures) 

Good to hear that you achieved the goal.

 

Addition. Since the single-line features from the Deaggregator are always output in the order of groups (i.e. the original multi-lines), you can set Yes to the Input is Ordered by Group parameter of the Aggregator in this case, so that the order of the features will be preserved and the performance might also be increased.

 


Good to hear that you achieved the goal.

 

Addition. Since the single-line features from the Deaggregator are always output in the order of groups (i.e. the original multi-lines), you can set Yes to the Input is Ordered by Group parameter of the Aggregator in this case, so that the order of the features will be preserved and the performance might also be increased.

 

Thanks for the tip, I set that parameter on the Aggregator and it looks like it shaved off 3-4 seconds for my 8,000 feature data set.

 

 


Reply