Skip to main content

I am sure this is probably covered in another post but can't seem to find the right solution :)

I have a list that I have exploded into its elements.

 

 

I have polygon layer that I need to add each of the names as a column in the polygon table so that I can put a value against each polygon for each column.

 

i.e.

PolygonID, Advertising Near Signalised Intersections, Affordable Housing, ...., etc

Are you looking to do this dynamically?

You can create a the attributes in an AttributeCreator using the value of name to be the new attribute name

You then aggregate your records choosing to merge attributes to get a single feature wiht all attributes, but you will then need to manually expose the attributes if you need them available on the canvas


Are you looking to do this dynamically?

You can create a the attributes in an AttributeCreator using the value of name to be the new attribute name

You then aggregate your records choosing to merge attributes to get a single feature wiht all attributes, but you will then need to manually expose the attributes if you need them available on the canvas

Thanks. I am trying to do it dynamically as the input will change and the number of columns. I have been able to automate the list creation but just cant convert that list to a series of new columns for the polygon dataset.


Thanks. I am trying to do it dynamically as the input will change and the number of columns. I have been able to automate the list creation but just cant convert that list to a series of new columns for the polygon dataset.

As long as you don't need them exposed on the canvas, you can handle this with a dynamic writer, what format are you writing to?


As long as you don't need them exposed on the canvas, you can handle this with a dynamic writer, what format are you writing to?

I am aiming to send it to excel


Effectively, with your list you already have something that can be used as a dynamic schema fairly easily, but where is the data that needs these attributes coming from? How are you wanting to set the values of the attributes?


Effectively, with your list you already have something that can be used as a dynamic schema fairly easily, but where is the data that needs these attributes coming from? How are you wanting to set the values of the attributes?

Thanks again. I have a polygon layer that will be used to intersect with each of the layers from the list and for each intersected parcel give it the value from the individual layer.


@deanhowell can you include a small example of what the source polygon will look like and what you expect the output to look like? I think tat would help the community understand the issue and nail down an answer for you.


Thanks again. I have a polygon layer that will be used to intersect with each of the layers from the list and for each intersected parcel give it the value from the individual layer.

Instead of trying to setup Attribute Names manually then, why not set the Attribute Names with with name of the incoming Layers rather than try to build them out of List?

For any incoming Layer Features that going to intersect, can expose the FME generated attribute "fme_feature_type" in the Reader settings to get the Layer "Name" as an exposed Attribute. This will then appear on the results of the intersection.


Instead of trying to setup Attribute Names manually then, why not set the Attribute Names with with name of the incoming Layers rather than try to build them out of List?

For any incoming Layer Features that going to intersect, can expose the FME generated attribute "fme_feature_type" in the Reader settings to get the Layer "Name" as an exposed Attribute. This will then appear on the results of the intersection.

Thanks @bwn, that is basically what I did to create the list. The various layers come in from a web map service and then are intersected with the underlying polygon (land parcels).

 

 

The results give me close to what I need but I need to output column names to be the layer name that intersects it.

 

In the example above I need it to look like

OBJECTID, Design, Prescribed Wells Area, State Heritage Place, .... etc

910080, Yes,Yes,Yes, No, No, Yes

 

The issue is there are up to 50 layers being intersected (but this will vary depending on source), so would like the column names to be dynamic.

 


@deanhowell can you include a small example of what the source polygon will look like and what you expect the output to look like? I think tat would help the community understand the issue and nail down an answer for you.

Thanks @markatsafe,

The source polygon table is a series of land parcels

 

Then we are trying to overlay a series of web map services which are also polygon layers with a name a description.

 

 

 

The output that I am seeking is the OBJECTID from the original parcel layer with a column for each intersect layer i.e. Hazards and the using the description as the attribute value.

eg

OBJECTID, Hazards (Bushfire - High Risk), Hazards (Bushfile - General Risk), ...etc

 


You can dynamically create Attribute Names base on the Layer Names like so. The Attribute Name itself can be generated using an Expression.

Similarly on the SpatialRelator, then setting the Merge Attribute setting to "Merge Supplier" will process all Layer names independently since the new Attribute Name generated by the AttributeCreator is unique to that Layer.

This will generate a "Y" value where there is a Spatial Intersection. Generating the "N" value with this technique is a bit trickier. One basic way may be to re-read in the written features and use NullAttributeMapper on this, otherwise there are other variations like created an an inverse spatial object of the test Layers (By Eg. Creating a Huge Box object that covers all the Base Features, Clipping that out and similarly using an AttributeCreator to set a "N" value against this so that SpatialRelator will return a "Y" or an "N" value for an intersection against the Test Layer features, or the inverse Test Layer Features)


You can dynamically create Attribute Names base on the Layer Names like so. The Attribute Name itself can be generated using an Expression.

Similarly on the SpatialRelator, then setting the Merge Attribute setting to "Merge Supplier" will process all Layer names independently since the new Attribute Name generated by the AttributeCreator is unique to that Layer.

This will generate a "Y" value where there is a Spatial Intersection. Generating the "N" value with this technique is a bit trickier. One basic way may be to re-read in the written features and use NullAttributeMapper on this, otherwise there are other variations like created an an inverse spatial object of the test Layers (By Eg. Creating a Huge Box object that covers all the Base Features, Clipping that out and similarly using an AttributeCreator to set a "N" value against this so that SpatialRelator will return a "Y" or an "N" value for an intersection against the Test Layer features, or the inverse Test Layer Features)

Thanks @bwn, I appreciate your continued help.

It is almost exactly what I have been trying since posting but I am seeing a very interesting issue with the column names being created but not being passed through to the output.

If I view the output from the attribute creator it has created the new columns, although they are not immediately visible.

If I then use an Attribute Manager to remove an unwanted columns, the newly created columns are not available.


Thanks @bwn, I appreciate your continued help.

It is almost exactly what I have been trying since posting but I am seeing a very interesting issue with the column names being created but not being passed through to the output.

If I view the output from the attribute creator it has created the new columns, although they are not immediately visible.

If I then use an Attribute Manager to remove an unwanted columns, the newly created columns are not available.

Open the output instead in Data Inspector. You will see that they do exist on the Output, but not in the Exposed Attributes.

Because we are creating the Attribute Names dynamically with this method using a calculated expression, then the FME Workspace itself doesn't know what the resulting Attribute Names will be. These become "Unexposed" attributes. They exist in the output, but are not able to be further interacted with in any further Workspace Transformers unless they are manually exposed in the Workspace using AttributeExposer (generally, some Transformers will still work with Unexposed Attributes and Writers will work in Dynamic Write mode) .

As long as you are only looking to dynamically write, and you don't need to give any special treatment to any of the individual unexposed Attribute Names/Values, then this doesn't matter.

 


Open the output instead in Data Inspector. You will see that they do exist on the Output, but not in the Exposed Attributes.

Because we are creating the Attribute Names dynamically with this method using a calculated expression, then the FME Workspace itself doesn't know what the resulting Attribute Names will be. These become "Unexposed" attributes. They exist in the output, but are not able to be further interacted with in any further Workspace Transformers unless they are manually exposed in the Workspace using AttributeExposer (generally, some Transformers will still work with Unexposed Attributes and Writers will work in Dynamic Write mode) .

As long as you are only looking to dynamically write, and you don't need to give any special treatment to any of the individual unexposed Attribute Names/Values, then this doesn't matter.

 

Thanks for the additional information. I can expose the attributes manually using the attribute exposer transformer, but that seems counter-intuitive for what I am trying to do as I am trying to create the attributes dynamically depending on the layers coming in.


Thanks for the additional information. I can expose the attributes manually using the attribute exposer transformer, but that seems counter-intuitive for what I am trying to do as I am trying to create the attributes dynamically depending on the layers coming in.

Creating the attribute names dynamically will virtually always be as unexposed attributes. That is the nature of dynamic workflows. In dynamic writing mode, this does not matter as both exposed and unexposed attributes get written in a Dynamic Writer.


Creating the attribute names dynamically will virtually always be as unexposed attributes. That is the nature of dynamic workflows. In dynamic writing mode, this does not matter as both exposed and unexposed attributes get written in a Dynamic Writer.

Thanks. M6 guess is i need to learn more about dynamic writers :)


Reply