| Revision 586,
1.1 KB
checked in by jdalbey, 6 years ago
(diff) |
|
realtime_VDS add bin folder and put scripts there.
|
-
Property svn:executable set to
*
|
| Line | |
|---|
| 1 | #!/bin/bash |
|---|
| 2 | # Files: vds_config_d12.csv is the config file with VDS lat/long and other identifying data |
|---|
| 3 | # 5minagg_latest.txt is the 5 min aggregate real time data. We need two fields: id and speed. |
|---|
| 4 | # |
|---|
| 5 | |
|---|
| 6 | # FIRST: Remove first line of 5minagg (contains date). |
|---|
| 7 | tail -n+2 5minagg_latest.txt > 5min_latest_tail.txt |
|---|
| 8 | # SECOND: sort it |
|---|
| 9 | sort 5min_latest_tail.txt > 5min_latest_sorted.txt |
|---|
| 10 | # Join the two files on the ID field, appending speed as the last field |
|---|
| 11 | join -t"," 5min_latest_sorted.txt vds_config_d12ML_sorted.csv -o 1.1,2.2,2.6,2.7,2.9,2.11,2.12,1.4 > vds_speeds.csv |
|---|
| 12 | |
|---|
| 13 | # |
|---|
| 14 | #3. Run this awk program to convert output csv to geojson |
|---|
| 15 | # |
|---|
| 16 | # Convert a csv with postmile and coordinates to a json file |
|---|
| 17 | # Note it switches lat/long to long/lat |
|---|
| 18 | # Sample invocation: |
|---|
| 19 | # Determine how many lines in file |
|---|
| 20 | eof=`wc vds_speeds.csv | cut -f3 -d" " ` |
|---|
| 21 | # Pass that as parameter to awk program, who uses it to not print a comma after last record. |
|---|
| 22 | awk -F',' -v eof="$eof" -f csvToGson.awk vds_speeds.csv > vds_speeds.gson |
|---|
| 23 | # Copy result from jdalbey home to dynamic_data folder on server |
|---|
| 24 | cp vds_speeds.gson /web/webapps/realtime_VDS/dynamicdata/vds_realtime.gson |
|---|
| 25 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.