1

Goal

To prioritize water lines in a network based on the building they service

Detail

I have a shapefile of water lines in a region. The lines are split at their vertices and form a network (more or less, will probably have to do some topo cleanup). What I want to do is find the "importance" of each pipe in the network based on the building it's connected to. That would be a simple spatial join, but I also want to attribute each connecting pipe in the network with that same info.

For example, a service line that's connected to a large building gets importance "10" (based on an attribute for that building). I want the lines that touch that service line at a shared vertex to also get a score of 10. I understand that redundant lines are present but this is for a proof-of-concept.

What I've tried

Ugly pseudocode:

for building in buildings_gdf:
    for pipe in pipes_gdf:
        if pipe.touches(building):
            pipe.buildings_connected_to = building.id + ", " # for multiple buildings

This gives me a gdf of pipes with the ID of the building they touch. But how can I find pipes that touch THESE pipes, all the way through the network, without a script that takes 10 years to run?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.