diff options
author | typebrook <typebrook@gmail.com> | 2019-10-24 18:45:31 +0800 |
---|---|---|
committer | typebrook <typebrook@gmail.com> | 2019-10-24 18:45:31 +0800 |
commit | 005b07bd7e66248692bb4ac6f7eab1fe33fe2016 (patch) | |
tree | 05b2126656df8047d99b06cad1eb7a2b3216ee0a /scripts/csv2geojson | |
parent | f8b90f8c8e0cdcb4e12862d4b393c1226675b287 (diff) |
update
Diffstat (limited to 'scripts/csv2geojson')
-rwxr-xr-x | scripts/csv2geojson | 5 |
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 | ||
3 | echo -------------- | 3 | echo -------------- |
4 | head -1 $1 | sed 's/,/ /g' | 4 | head -1 $1 | sed 's/,/ /g' | awk '{for (i=1; i<=NF; i++) printf $i "_" i " "; print ""}' |
5 | echo -------------- | 5 | echo -------------- |
6 | echo | 6 | echo |
7 | 7 | ||
@@ -11,5 +11,6 @@ read -p "Number of longitude column: " lon_col | |||
11 | sed 's/[^,]*/"\0"/g' $1 |\ | 11 | sed 's/[^,]*/"\0"/g' $1 |\ |
12 | sed 's/.*/[\0]/g' |\ | 12 | sed 's/.*/[\0]/g' |\ |
13 | sed '1d' |\ | 13 | sed '1d' |\ |
14 | jq '. | {"type": "Feature", "properties": {}, "geometry":{ "type": "Point", "coordinates": [(.[-1] | tonumber), (.[-2] | tonumber)] } }'|\ | 14 | jq --arg LAT_INDEX $lat_col LON_INDEX $lon_col '. | {"type": "Feature", "properties": {}, "geometry":{ "type": "Point", "coordinates": [(.[LAT_INDEX] | tonumber), (.[LON_INDEX] | tonumber)] } }'|\ |
15 | jq -s '{"type": "FeatureCollection", "features": .}' | 15 | jq -s '{"type": "FeatureCollection", "features": .}' |
16 | #awk '{for (i=1; i<= NF; i++) if (i != 2 && i != 3) printf $i " "; printf [ " " {; print ""}' test' ]}' | ||