Question

load attribute value into existing attribute fields

  • 26 September 2016
  • 4 replies
  • 2 views

Badge

I have 2 shapes, both have the same primary key (ST123).

The first shape has 2 attributes filled and 1 empty (height), the second shape has the primary key and Height-attribute filled.

How can I load the height of shape 2 into the empty height-row of shape 1, based on the primary key: ST123 without adding the information into an extra row.

Example:

IDwidthheightSHAPE 1ST12310<NULL>SHAPE 2ST12315RESULT SHAPE 1ST1231015

When I use the attributecopier/ attributemanager in FME then I get an extra row with in row 1 ST123 and the Width and in row 2 ST123 and the height.

Thank you, Marlies


4 replies

Badge +1

Hi Marlies, remove the empty 'Height' attribute in your first shapefile using the 'AttributeRemover transformer'. Use the Featuremerger transformer afterwards to join the two shapefiles based on your primary key. This will give the desired result.

Userlevel 4

Use a FeatureMerger on the ID attribute.

Make sure to first use a NullAttributeMapper on both the Requestor and the Supplier to map NULL values to Missing, e.g.:

Userlevel 1
Badge +21

An aggregator grouping by ID with accumulation mode set to merge incoming attributes after a nullattributemapper will also work

This would be a better choice if you had more than just two attributes to merge, e.g. height, width & length

Badge +16

To transfer attributes from one feature to another a merge is necessary, as pointed out the feature merger is a way to achieve that.

Pay careful attention to the settings of the transformer to avoid any 'surprises'

Reply