NEW ST_Point('POINT ('||"C_LONGITUDE"||' '||"C_LATITUDE"||')', 4326)
select "G_CREATED", "C_TIMESTAMP", "C_LONGITUDE", "C_LATITUDE"
from "T_IOT_A7B01790F3E80BC544A3"
where TO_DATE("G_CREATED") = '2018-03-05'
order by "G_CREATED" asc;
STRING_AGG
aggregation to properly format string.SELECT
ST_GeomFromText('LINESTRING ('||STRING_AGG("C_LONGITUDE"||' '||"C_LATITUDE",', ' ORDER BY G_CREATED)||')',4326).ST_asWKT() as "path"
FROM "T_IOT_A7B01790F3E80BC544A3"
WHERE TO_DATE("G_CREATED") = '2018-03-05';
LINESTRING (-0.12767942670274082 51.493476107500115,-0.1276470738968785 51.4934737428734,-0.12788387803363319 51.4941326330944,...,-0.12918044569300738 51.49937907039622,-0.12916212266345334 51.499476483603914)
Meta
and then Load WKT String
. Now I can paste the WKT output of the SQL and http://geojson.io will convert it to GeoJSON for me and display the path of my walk visualized (I modified styling to make it better visible). It was a pleasant walk I must say: via St. John's Garden and Westminster Dean's Yard.SELECT
ST_GeomFromText('LINESTRING ('||STRING_AGG("C_LONGITUDE"||' '||"C_LATITUDE",', ' ORDER BY G_CREATED)||')',4326).ST_length()
/SECONDS_BETWEEN (MIN("G_CREATED"),MAX("G_CREATED"))*3600/1000 as "km/h"
FROM "T_IOT_A7B01790F3E80BC544A3"
WHERE TO_DATE("G_CREATED") = '2018-03-05';
--The result was 5.2397373242698135 in km/h
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
19 | |
14 | |
11 | |
10 | |
9 | |
8 | |
7 | |
7 | |
7 | |
5 |