diff --git a/build b/build index 28bfd18..7acd16f 100755 --- a/build +++ b/build @@ -41,6 +41,7 @@ if [[ "$#" -lt 1 ]]; then echo -e " ${CACTION}client-watch${RS} - Auto-rebuild the client-side code on modification."; echo -e " ${CACTION}dev-server${RS} - Start the development web server for the web interface."; echo -e " ${CACTION}dev-server-stop${RS} - Stop the development web server."; + echo -e " ${CACTION}geojson-debug${RS} - Generate some GeoJSON from the raw readings for debugging purposes (paste into geojson.io)"; echo -e ""; exit 1; @@ -200,6 +201,9 @@ task_dev-server-stop() { task_end $?; } +task_geojson() { + sqlite3 lorawan.sqlite 'SELECT readings.latitude, readings.longitude, rssis.rssi FROM readings LEFT JOIN rssis ON readings.id = rssis.reading_id ORDER BY readings.latitude,readings.longitude;' | perl -pe 'chomp if eof' | jq --raw-input --slurp 'split("\n") | map(split("|") | map(if . == "" then null else tonumber end)) | map({type: "Feature", geometry: { type: "Point", "coordinates": [ .[1], .[0] ] }, properties: { "rssi": .[2], "marker-color": (if .[2] == null then "#dd0707" else "#04a104" end), "marker-symbol": "circle" }}) | { type: "FeatureCollection", features: . }' +} ###############################################################################