aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/csv2geojson5
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/csv2geojson b/scripts/csv2geojson
index 49ed0c9..90e6141 100755
--- a/scripts/csv2geojson
+++ b/scripts/csv2geojson
@@ -1,7 +1,7 @@
1#! /bin/bash 1#! /bin/bash
2 2
3echo -------------- 3echo --------------
4head -1 $1 | sed 's/,/ /g' 4head -1 $1 | sed 's/,/ /g' | awk '{for (i=1; i<=NF; i++) printf $i "_" i " "; print ""}'
5echo -------------- 5echo --------------
6echo 6echo
7 7
@@ -11,5 +11,6 @@ read -p "Number of longitude column: " lon_col
11sed 's/[^,]*/"\0"/g' $1 |\ 11sed 's/[^,]*/"\0"/g' $1 |\
12sed 's/.*/[\0]/g' |\ 12sed 's/.*/[\0]/g' |\
13sed '1d' |\ 13sed '1d' |\
14jq '. | {"type": "Feature", "properties": {}, "geometry":{ "type": "Point", "coordinates": [(.[-1] | tonumber), (.[-2] | tonumber)] } }'|\ 14jq --arg LAT_INDEX $lat_col LON_INDEX $lon_col '. | {"type": "Feature", "properties": {}, "geometry":{ "type": "Point", "coordinates": [(.[LAT_INDEX] | tonumber), (.[LON_INDEX] | tonumber)] } }'|\
15jq -s '{"type": "FeatureCollection", "features": .}' 15jq -s '{"type": "FeatureCollection", "features": .}'
16#awk '{for (i=1; i<= NF; i++) if (i != 2 && i != 3) printf $i " "; printf [ " " {; print ""}' test' ]}'