Skip to content

Instantly share code, notes, and snippets.

@johnjohndoe
Created April 29, 2014 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnjohndoe/11401693 to your computer and use it in GitHub Desktop.
Save johnjohndoe/11401693 to your computer and use it in GitHub Desktop.
Temporal query in QGIS

SpatiaLite field

  • Column name: time
  • Type: VARCHAR
  • Example value: 2014/04/25 20:30:00

WHERE clause for temporal subset query

DATETIME(
   substr(time,1,4)||'-'||
   substr(time,6,2)||'-'||
   substr(time,9,2)||' '||
   substr(time,12,8)
) > DATETIME('2014-04-25 18:00:00') AND 
DATETIME(
   substr(time,1,4)||'-'||
   substr(time,6,2)||'-'||
   substr(time,9,2)||' '||
   substr(time,12,8)
) < DATETIME('2014-04-25 20:30:00')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment