Skip to main content

I am using NetworkTopologyCalculator to categorise streets by what network they are a part of, with the aim of only keeping the main network and discarding the islands.

How do I determine the most common network_id value?

And then how to I place that value into an AttributeFilter to only keep those features?

The documentation doesn't say, but it's been my experience that the largest network is always _network_id 1.


You could run it into a StatisticsCalculator and search for the Mode. That would show which network_id value occurs the most. Then just filter based on that.


The documentation doesn't say, but it's been my experience that the largest network is always _network_id 1.

That's been my experience too, but I'm not sure if it's 100% always the case.


You could run it into a StatisticsCalculator and search for the Mode. That would show which network_id value occurs the most. Then just filter based on that.

StatisticsCalculator Mode does give me the correct value, thanks!

But how do I pass that value to the AttributeFilter?


@nicholas You can't rely on _network_id = 1 being the dominate network. It usually is, but this is probably only because the first feature to be processed is more likely to be on that network. @drc43 's suggestion of using the StatisticsCalculator Mode and then test the output from the Complete port for _network_id = _network_id.Mode is probably the safest route.

It is possible that you have more than one valid network (perhaps the networks do not connect at a pump station or you have several feeders). In this case, use the StatisticsCalculator Total Count and Group By _network_id. Then you'll have to estimate how many segments are likely to form a 'valid' portion of the network.


StatisticsCalculator Mode does give me the correct value, thanks!

But how do I pass that value to the AttributeFilter?

You'd probably use a Tester instead, but either way the value should be an attribute available in the Tester or AttributeFilter parameters.


@nicholas You can't rely on _network_id = 1 being the dominate network. It usually is, but this is probably only because the first feature to be processed is more likely to be on that network. @drc43 's suggestion of using the StatisticsCalculator Mode and then test the output from the Complete port for _network_id = _network_id.Mode is probably the safest route.

It is possible that you have more than one valid network (perhaps the networks do not connect at a pump station or you have several feeders). In this case, use the StatisticsCalculator Total Count and Group By _network_id. Then you'll have to estimate how many segments are likely to form a 'valid' portion of the network.

Thanks for the confirmation @markatsafe

The StatisticsCalculator calculates the mode as an attribute value. How do I then use that attribute vale to select features with that _network_id?

I thought I could use an AttributeFilter, but I don't know how to convert the output of StatisticsCalculator into the value for AttributeFilter


You just want to use the Complete Output Port from the statistics calculator

 


Thanks for the confirmation @markatsafe

The StatisticsCalculator calculates the mode as an attribute value. How do I then use that attribute vale to select features with that _network_id?

I thought I could use an AttributeFilter, but I don't know how to convert the output of StatisticsCalculator into the value for AttributeFilter

You just want to use the Complete Output Port from the statistics calculator

 


@ebygomm, your suggestion of combining StatisticsCalculator (calculate mode) and FeatureMerger (the mode becomes the Supplier to the FeatureMerger works. Thanks!

Basically, FeatureMerger merges the output from NetworkTopologyCalculator (_network_id) with the output from StatisticsCalculator (_mode) and the only features that are merged are the ones where _network_id = _mode

I'm trying to accept it as the best answer, but there isn't an Accept button next to your answer :-(

Anyway, anyone else looking at this, you have to click on the image links to see the answer set out properly


@ebygomm, your suggestion of combining StatisticsCalculator (calculate mode) and FeatureMerger (the mode becomes the Supplier to the FeatureMerger works. Thanks!

Basically, FeatureMerger merges the output from NetworkTopologyCalculator (_network_id) with the output from StatisticsCalculator (_mode) and the only features that are merged are the ones where _network_id = _mode

I'm trying to accept it as the best answer, but there isn't an Accept button next to your answer :-(

Anyway, anyone else looking at this, you have to click on the image links to see the answer set out properly

I actually meant to remove that answer, if you are using the mode there is not need to use the featuremerger at all.


Reply