mirror of
https://github.com/gama-platform/gama.git
synced 2026-07-09 18:21:00 +00:00
Page:
CleaningGISData
Pages
3D_Graph
3D_shapefile_loading
ASCII_File_to_DEM_Representation
Accessing_Fields
Agent_Based_Clustering
AnalysingCodePerformance
Anisotropic_Diffusion_Simple_Field
AntsForaging.gaml
AntsForaging
Boids_3D_Motion
CallingR
Casting_Images
Changelog
City_Evacuation
CleaningGISData
CodeExamples
Community
Computation_of_the_shortest_path_on_a_Grid_of_Cells
ContinuousFieldofVision.gaml
ContinuousMove
Contour_Lines_Import
CreatingAReleaseOfGama
Creating_color_and_sort_cubes_by_color
DEM_Generator
DXF_to_Agents_Model
Developing Plugins
DifferentialEquations
Directed_Graph_Model
Drive_Random
ESRI_ASCII_to_grid_model
Ensure model reproducibility
Eroding_Volcano
Exhaustive list of GAMA Keywords
FallingObjects
Flow_on_Terrain
GEOJSON_File_Loading
G__BlankPage
G__GraphicalEditor
G__GraphicalEditorTutorial
GamlReferences
GetGamaDevCodeUsingEclipsePlugin
Graph_Generation
Graph_Generation_using_Agents
Headless mode for dummies
HeadlessBatch
HeadlessLegacy
HeadlessServer
HeadlessTutorial
Home
HydrologicaModel
Image_Manipulation
Image_Vectorisation
Index
InstallingDevVersion
Introduction To Gama Java API
K_Nearest_Neighbors
Life
MODAVI
MondrianCity
Movement_of_an_agent_on_different_paths
Movement_on_a_Graph_created_by_Polygons
Movement_on_a_Grid_of_Cells
Movement_on_a_Grid_of_Cells_
Moving3D
Moving_3D_Object
NetlogoTrafficmodel2
ODE_LotkaVolterra
OSM_file_to_Agents
Pedagogical Materials
PlayPool
PreviousConferences
Resources_TrainingVideos
RunningHeadless
SIRAnalysis
SIRAnalysis_step1
SIRAnalysis_step2
SIRAnalysis_step3
SIRAnalysis_step4
SIRAnalysis_step5
SIRAnalysis_step6
SIRAnalysis_step7
SIR_Split_in_Agents_Multiple_Strains
Save and restore simulations
Segregation_Agents
Series
Shapefile_to_Agents
Simple_Intersection
Simple_Traffic_Model
Soccer_Game
SpatialGraph3d
Stochastic_Differential_Equations
Strahler
Sugarscape
Team
Traffic_and_Pollution
TreesAndSeasons
UserResources
Using extensions
UsingGamaFlags
Wander
Waterflowgridelevation
Writing_Tests
comparison_ABM_EBM_SIR
developingGAMA
generate_pedestrian_paths
pedestrian_complex_environment
pedestrian_simple_environment
stairs
No results
1
CleaningGISData
Ha Dang Hoang edited this page 2024-10-31 11:59:08 +07:00
Example usage of clean_network in GAMA Platform
Introduction
The clean_network operator can be used used for cleaning and optimizing road networks. It helps deal with issues in GIS data such as disconnected segments, overlapping roads, and imprecise geometry.
Syntax
clean_network(
list<geometry> geometries,
float tolerance,
bool split_lines,
bool keepMainConnectedComponent
)
Parameters Explained
1. geometries (list)
- What it is: Collection of geometries (usually road segments) to clean
- How to get it:
road collect each.shapeorroad_shapefile.contents - Example:
list<geometry> road_geometries <- road collect each.shape;
list<geometry> road_geometries <- road_shapefile.contents;
2. tolerance (float)
- What it is: Maximum distance between points to be considered for merging
- Recommended values:
- Small networks: 0.1 to 1.0 (e.g., urban network)
- Large networks: 1.0 to 5.0 (e.g., rural network, highway network)
- Effects:
- Lower values (e.g., 0.1): More precise, less merging
- Higher values (e.g., 5.0): More aggressive merging
- Example scenarios:
- For precise road networks:
tolerance <- 0.5 - For rough networks:
tolerance <- 2.0
- For precise road networks:
3. split_lines (boolean)
- What it is: Whether to split roads at intersection points
- Values:
- true: Split roads at intersections (recommended for navigation)
- false: Keep roads as continuous lines
- When to use:
- true: For routing and navigation purposes
- false: For visualization or analysis only
4. keepMainConnectedComponent (boolean)
- What it is: Whether to keep only the main connected network
- Values:
- true: Remove isolated road segments
- false: Keep all road segments
- When to use:
- true: For ensuring network connectivity
- false: When isolated segments are important
Common Usage
Basic Network Cleaning
// Basic cleaning with default values
list<geometry> clean_lines <- clean_network(
road collect each.shape,
1.0, // moderate tolerance
true, // split at intersections
true // keep only main network
);
Implementation Example
global {
// Network cleaning parameters
float tolerance <- 1.0;
bool split_lines <- true;
bool keep_main_connected <- true;
init {
// Create initial roads
create road from: road_shapefile;
// Clean the network
list<geometry> clean_lines <- clean_network(
road collect each.shape,
tolerance,
split_lines,
keep_main_connected
);
// Remove old roads
ask road {
do die;
}
// Create new roads
loop clean_geom over: clean_lines {
create road {
shape <- clean_geom;
}
}
// Create network graph
road_network <- as_edge_graph(road);
}
}
Home
Platform
- Installation and Launching
- Workspace, Projects and Models
- Editing Models
- Running Experiments
- Running Headless
- Preferences
- Troubleshooting
Learn GAML step by step
- Introduction
- Manipulate basic Species
- Global Species
- Defining Advanced Species
- Defining GUI Experiment
- Exploring Models
- Optimizing Models
- Multi-Paradigm Modeling
Recipes
- Manipulate OSM Data
- Cleaning OSM Data
- Diffusion
- Using Database
- Using FIPA ACL
- Using BDI with BEN
- Using Driving Skill
- Manipulate dates
- Manipulate lights
- Using comodel
- Save and restore Simulations
- Using network
- Headless mode
- Using Headless
- Writing Unit Tests
- Ensure model's reproducibility
- Going further with extensions
GAML References
- Built-in Species
- Built-in Skills
- Built-in Architecture
- Statements
- Data Type
- File Type
- Expressions
- Exhaustive list of GAMA Keywords
Developing GAMA
- Installing the development version
- Developing Extensions
- Introduction to GAMA Java API
- Using GAMA flags
- Creating a release of GAMA
- Documentation generation