Update Dev Notes
parent
5526532d97
commit
90f7f0c22c
@ -1,11 +1,12 @@
|
|||||||
## 20240117
|
## 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
|
```sql
|
||||||
CREATE OR REPLACE VIEW qgis_friendly AS
|
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
|
(SELECT
|
||||||
|
deduplication_id,
|
||||||
rx_info -> 0 ->> 'gatewayId',
|
rx_info -> 0 ->> 'gatewayId',
|
||||||
time,
|
time,
|
||||||
CAST (object -> 'gpsLocation' -> '1' ->> 'altitude' AS FLOAT),
|
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 (object -> 'gpsLocation' -> '1' ->> 'longitude' AS FLOAT),
|
||||||
CAST (rx_info -> 0 ->> 'rssi' AS INTEGER)
|
CAST (rx_info -> 0 ->> 'rssi' AS INTEGER)
|
||||||
FROM event_up)
|
FROM event_up)
|
||||||
SELECT
|
SELECT
|
||||||
|
id,
|
||||||
gatewayId,
|
gatewayId,
|
||||||
time,
|
time,
|
||||||
ST_SetSRID(ST_MakePoint(lon, lat, alt), 4326) AS location,
|
ST_SetSRID(ST_MakePoint(lon, lat, alt), 4326) AS location,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user