Skip to main content

Morning. I'm trying to create an upstream trace on a network using a loop. A feature finds the upstream id of it's nearest conduit, then uses a FeatureMerger to join with a shapefile of conduits and find the feature with that ID as it's downstream id, therefore moving one length of conduit upstream. It then loops back to the start to check if that conduit has a particular value and outputs if so, or does another upstream trace if not.

 

FeatureMerger is a blocking transformer and I've followed all the tutorials to create a custom transformer for looping with blocking transformers, but I still get the error "UpstreamTraceDWF_FeatureMerger is blocking and cannot be used in a loop..." and it then crashes.

 

Does anyone know a way around this or is there a better way to upstream trace I could use?

I have found that Variables can be used to create temporary lookup tables that can be used to avoid feature merging. So you could use VariableSetters to store the nodes on a segment, with the first variable name being the first node number, and the value being the second node. Then create a second variable with name being the second node number and value being the first node. You can use prefixes on the names if you need to create multiple lookup tables. For example, you may have the prefix 'join_' for looking up connect nodes, while the prefix 'type_' is used to set up a table of conduit types.

All the conduits would pass through the VariableSetters to create the lookup tables, then the loop would use VariableRetrievers to get the first level of connections. Test to see if you have hit your target. If not, go back to the loop input, with the next iteration looking for the connections to the retrieved variables instead of the original conduit id.

This method is not a blocker, and runs quite quickly. Internally, the variables are stored in a SQLite database which can easily handle several million values, so the lookup tables can be quite large.


Reply