gama-platform / gama.old

Main repository for developing the 1.x versions of GAMA
GNU General Public License v3.0
303 stars 99 forks source link

clean_network does not split 2 geometries with a T shape #2916

Closed benoitgaudou closed 4 years ago

benoitgaudou commented 4 years ago

Describe the bug Using the clean_network operator to clean a shapefile coming from OSM seems to remove too many roads (when the option reduce_to_main_connected_components is set to true).

To Reproduce Steps to reproduce the behavior:

  1. Download and import the following project TestTrafficData.zip
  2. Run the model Clean Line Network.gaml or look at the 2 files produced by the model:
    • roads2true.shp: only the main connex component
    • roads2false.shp: all the components

Expected behavior It is expected that after cleaning most of the roads to be in the main component.

Desktop (please complete the following information):

benoitgaudou commented 4 years ago

Hi,

The previous issue can be easily reproduced with the following simple model:

global {
    init {
        list<geometry> lines; 
        list<geometry> clean_lines ;

        lines <- [line({10,10}, {20,20}), line({10.0,20.0,0.0},{15.0,15.0,0.0})];

        clean_lines <- clean_network(lines,3.0,true,false) ;
        write length(clean_lines);
        write clean_lines;

        clean_lines <- split_lines(lines,true) ;        
        write length(clean_lines);
        write clean_lines;  

        clean_lines <- split_lines(lines) ;
        write length(clean_lines);
        write clean_lines;
    }
}

Note that split_lines(list<geometry>) works very well to split the 2 geometries in 3. But clean_network and split_lines(list<geometry>, bool) (used by clean_network), does not work in this case.

In addition, split_lines(list<geometry>, bool) does not use its boolean operand.