blob: 90e6141b400f743303df6fe693e5607860d9312a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#! /bin/bash
echo --------------
head -1 $1 | sed 's/,/ /g' | awk '{for (i=1; i<=NF; i++) printf $i "_" i " "; print ""}'
echo --------------
echo
read -p "Number of latitude column: " lat_col
read -p "Number of longitude column: " lon_col
sed 's/[^,]*/"\0"/g' $1 |\
sed 's/.*/[\0]/g' |\
sed '1d' |\
jq --arg LAT_INDEX $lat_col LON_INDEX $lon_col '. | {"type": "Feature", "properties": {}, "geometry":{ "type": "Point", "coordinates": [(.[LAT_INDEX] | tonumber), (.[LON_INDEX] | tonumber)] } }'|\
jq -s '{"type": "FeatureCollection", "features": .}'
#awk '{for (i=1; i<= NF; i++) if (i != 2 && i != 3) printf $i " "; printf [ " " {; print ""}' test' ]}'
|