Using Lists to Solve Problems

Example Using Intersector and ListConcatenator

You have linear street centerlines and at each intersection point, you'd like to know which streets come together. The output should be a set of points, each with a single string attribute containing a comma-separated set of the street names.

You can solve this by setting up a workspace that routes all the street centerlines into an Intersector. Adjust the parameters of the Intersector to supply a list name, for example, all_streets.

Let's assume that the input street lines had an attribute called NAME.  Now, among other things, the NODE output of the Intersector will have an unqualified list on it called all_streets{}.NAME.  This list will hold the names of all the streets that intersect at each particular point (or NODE) that is output.

To turn the list of NAMEs into a single string, your'd add a ListConcatenator transformer and run the NODE features into it. Then you'd set up the ListConcatenator's parameters so that it would put the contents of the all_streets{}.NAME list together, separated by commas, into the "result" attribute.

Lastly, you'd route the output of the ListConcatenator to an output file, and ensure that the "result" attribute was routed to an attribute in the output. After running the translation, you'd have the desired result.

Note that you could also access the individual street names by "exposing" some elements of your list (by right clicking on the attribute unqualified list name (in our example,  "all_streets{}.NAME") and saying "Expose Elements", and entering the number of elements to expose. You'd then have to do something with those elements in your translation.  (The disadvantage of the this approach is that you need to know ahead of time how many list elements you want to work with -- so if 3 streets intersect at the same node and you only set yourself up to handle two, you'd have to do something special to handle that.)