diff --git a/README.md b/README.md index cf27bd6..244e5dc 100755 --- a/README.md +++ b/README.md @@ -1,38 +1,57 @@ # TheRoadProject -## How to run: +## How to run: cd ../Path/to/TheRoadProject -### For Generation section points: +### For Generation section points: This script will give you set of points *A1, A2 , A3 ...... An.* at particular distance *D* on given polyline representing the road. Plus a Set of points *(Pn1,Pn2)* perpendicular to a point at *P/2* distance apart from point An -* python TheRoad.py \ \
\ -* python TheRoad.py input.csv *P* *D* -* e.g. - `python TheRoad.py road.csv 10 40` - + +* ```python TheRoad.py
``` +* python TheRoad.py input.csv *P* *D* +* e.g. + ```python TheRoad.py road.csv 10 40``` + + +It will output two files: section.csv and and length.csv + ### GRASS GIS Scripts: -First open GRASS and select/create Location -1. This script will generate contours in Grass and also raster and vector maps +1. First open GRASS and select/create Location + +2. Run contour.sh + + ```bash contour.sh ``` + + This script will generate contours in Grass and also raster and vector maps for given set of data. Data set will be in CSV format `X|Y|Z` (You can refer example/GrassData.txt). We can define region of maps in CSV format in another CSV file containing only north, east, south, west values for given map. We can also divide the full map into small maps to increase the speed of execution or for many other purposes by providing more than one north, east, south, west values for each smaller map. (You can refer example/DM1.txt) - * bash contour.sh \ \ - * e.g. `bash contour.sh example/GrassData.txt example/DM1.txt` -2. This script will generate RL points on given polyline (in form of CSV file in format *X,Y* you can refer to example/road.csv) - * bash road.sh \ \ + * e.g. ```bash contour.sh example/GrassData.txt example/DM1.txt``` + +3. Run road.sh + + ```bash road.sh ``` + + This script will generate RL points on given polyline (in form of CSV file in format *X,Y* you can refer to example/road.csv) + * e.g. - `bash road.sh example/road.csv Final.txt` + ```bash road.sh example/road.csv Final.csv 6``` + + Process the output file to remove entries with `*` as RL value + +4. Run makeSection.sh + + ```bash makeSection.sh ``` + + This script will generate RL points for given Sections (in form of CSV file generated by *TheRoad.py* you can refer to example/road.csv) -3. This script will generate RL points given Sections (in form of CSV file generated by *TheRoad.py* you can refer to example/road.csv) - * bash makeSection.sh \ - * e.g. `bash makeSection.sh example/section.csv` + * e.g. ```bash makeSection.sh section.csv 6``` ### To get graph of output of TheRoad.py: -* sage plot.sage \< inputFile.csv> -* `sage plot.sage road.csv` +* ```sage plot.sage ``` +* ```sage plot.sage road.csv``` diff --git a/TheRoad.py b/TheRoad.py index c631c25..dfc237b 100755 --- a/TheRoad.py +++ b/TheRoad.py @@ -31,7 +31,7 @@ distanceList.append(dis) -output=open('lenght.csv', 'wb') +output=open('length.csv', 'wb') writer = csv.writer(output) output=open('section.csv', 'wb') writer2 = csv.writer(output) diff --git a/contour.sh b/contour.sh index 2999996..a724806 100755 --- a/contour.sh +++ b/contour.sh @@ -43,7 +43,7 @@ echo $no_lines contour_val="contourVec$i" # Create region with resolution in y direction "nsres=1" and x direction "ewres=0.01" - g.region n=$var1 s=$var2 e=$var3 w=$var4 nsres=1 ewres=0.01 + g.region n=$var1 s=$var2 e=$var3 w=$var4 nsres=1 ewres=1 # Create vector map with input as fieldData v.surf.rst --overwrite input=fieldData layer=0 elev=$elev_val diff --git a/example/DM1.txt b/example/DM1.txt index e9f644c..13d9a96 100755 --- a/example/DM1.txt +++ b/example/DM1.txt @@ -1,4 +1,6 @@ -3423000,3421500,595250,594250 +3423000,3421500,595250,594250 3421750,3420250,595000,594000 3420500,3419000,594250,593250 - +3419250,3417750,594500,593500 +3418000,3416500,594250,593250 +3416750,3415250,594000,593000 diff --git a/makeSection.sh b/makeSection.sh index 1732d82..99e6cd4 100755 --- a/makeSection.sh +++ b/makeSection.sh @@ -7,7 +7,7 @@ rm -rf profileData mkdir profileData rm temp.txt touch temp.txt -for j in $(seq 1 6) +for j in $(seq 1 $2) do g.region raster=DTM$j inc=0 diff --git a/road.sh b/road.sh index 5fc7238..381f89a 100755 --- a/road.sh +++ b/road.sh @@ -6,7 +6,7 @@ no_lines=$(cat $file| wc -l) rm $2 rm temp.txt touch temp.txt -for j in $(seq 1 6) +for j in $(seq 1 $3) do g.region raster=DTM$j r.profile input="DTM$j" file=$1 output="temp.txt" --overwrite