Skip to content

Commit

Permalink
Improvements in script
Browse files Browse the repository at this point in the history
  • Loading branch information
amarjeetkapoor1 committed Mar 14, 2017
1 parent 4bb57db commit 6e29c05
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 25 deletions.
57 changes: 38 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 \<inputFile.csv> \<Section> \<distance-between-two-sections-lines>
* python TheRoad.py input.csv *P* *D*
* e.g.
`python TheRoad.py road.csv 10 40`


* ```python TheRoad.py <inputFile.csv> <Section> <distance-between-two-sections-lines>```
* 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 <DATA set for generating map> <File defining region for each map>```

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 \<DATA set for generating map> \<File defining region for each map>
* 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 \<Input file of points to generate profile > \<output file name>
* e.g. ```bash contour.sh example/GrassData.txt example/DM1.txt```

3. Run road.sh

```bash road.sh <Input file of points to generate profile> <output file name> <Number of regions>```

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 <List of section points> <Number of regions>```

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 \<List of section points>
* 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 <inputFile.csv>```
* ```sage plot.sage road.csv```
2 changes: 1 addition & 1 deletion TheRoad.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion contour.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions example/DM1.txt
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion makeSection.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion road.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6e29c05

Please sign in to comment.