Skip to main content
Question

Most common network_id from NetworkTopologyCalculator?


nicholas
Contributor
Forum|alt.badge.img+11

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?

11 replies

jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • June 25, 2020

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


drc43
Contributor
Forum|alt.badge.img+11
  • Contributor
  • June 25, 2020

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.


ebygomm
Influencer
Forum|alt.badge.img+33
  • Influencer
  • June 25, 2020
jdh wrote:

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.


nicholas
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • June 25, 2020
drc43 wrote:

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?


Forum|alt.badge.img+2

@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.


mark2atsafe
Safer
Forum|alt.badge.img+44
nicholas wrote:

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
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • June 28, 2020
markatsafe wrote:

@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


ebygomm
Influencer
Forum|alt.badge.img+33
  • Influencer
  • June 29, 2020

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

 


ebygomm
Influencer
Forum|alt.badge.img+33
  • Influencer
  • June 29, 2020
nicholas wrote:

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

 


nicholas
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • June 29, 2020

@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
Influencer
Forum|alt.badge.img+33
  • Influencer
  • June 30, 2020
nicholas wrote:

@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.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings