From 90f7f0c22c21449ca177f15ff9a27dc8196fa3ea Mon Sep 17 00:00:00 2001 From: Jon Roeber Date: Thu, 18 Jan 2024 06:12:57 +0000 Subject: [PATCH] Update Dev Notes --- Dev-Notes.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Dev-Notes.md b/Dev-Notes.md index bfe6a84..7c7e8e0 100644 --- a/Dev-Notes.md +++ b/Dev-Notes.md @@ -1,11 +1,12 @@ ## 20240117 -Example SQL query to create a `qgis_friendly` view that converts Cayenne GPS location into PostGIS point, includes RSSI, time, and gatewayId, and filters on gatewayId: +Example SQL query to create a `qgis_friendly` view that converts Cayenne GPS location into PostGIS point, includes unique ID, RSSI, time, and gatewayId, and filters on gatewayId: ```sql CREATE OR REPLACE VIEW qgis_friendly AS -WITH data(gatewayId, time, alt, lat, lon, rssi) AS +WITH data(id, gatewayId, time, alt, lat, lon, rssi) AS (SELECT + deduplication_id, rx_info -> 0 ->> 'gatewayId', time, CAST (object -> 'gpsLocation' -> '1' ->> 'altitude' AS FLOAT), @@ -13,7 +14,8 @@ WITH data(gatewayId, time, alt, lat, lon, rssi) AS CAST (object -> 'gpsLocation' -> '1' ->> 'longitude' AS FLOAT), CAST (rx_info -> 0 ->> 'rssi' AS INTEGER) FROM event_up) -SELECT +SELECT + id, gatewayId, time, ST_SetSRID(ST_MakePoint(lon, lat, alt), 4326) AS location,