Add geojson-debug build task
This commit is contained in:
parent
903639bba8
commit
126f2bdac2
1 changed files with 4 additions and 0 deletions
4
build
4
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: . }'
|
||||
}
|
||||
|
||||
###############################################################################
|
||||
|
||||
|
|
Loading…
Reference in a new issue