I'd like to:

  1. Load a 1-second interval GPS trace (not GPX) into PostGIS
  2. Then query the table at sub-second accuracy (about 5Hz), and get PostGIS to interpolate the location by time.

Is this possible, or am I dreaming?

The need is trying to find the lat/long of each frame in a Hawkeye video file, given a companion GPS trace in CSV format. If there are better ways to achieve this, I'm very open to them!

I'm familiar with PostGIS, but would consider other tools. I don't have access to ESRI.

The GPS data looks like this:


The video frame data looks like this:

File entry count,Primary key, Frame number for the corresponding AVI file of the same name,UnsyncedPkHb3,UnsyncedPkHb2,LightCond,Brght,Gamma,Shut,ReqLum,Lum,Gain,Iris,Timestamp
1,59375291559140,0,59375291574176,59375291574176,9,0,110,625,10,0.00,268,0,1970:01:01 04:37:24.382478
2,59375291649744,1,59375291664882,59375291664882,9,0,110,625,10,0.00,268,0,1970:01:01 04:37:25.288534
3,59375291740362,2,59375291755985,59375291755985,9,0,110,625,10,0.00,268,0,1970:01:01 04:37:26.194716
4,59375291831084,3,59375291846200,59375291846200,9,0,110,625,10,0.00,268,0,1970:01:01 04:37:27.101950


In response to the question regarding output format:


  • Table of lat-longs, recorded at 1Hz
  • Table of photo file names, recorded at 5Hz, without lat-longs


  • Table of photo file names, recorded at 5Hz, with lat longs.
  • 1
    Yes, you should be able to use ST_Line_Interpolate_Point for this, using the change in time and required framerate to calculate the second parameter. I would have put up an example, but I am not too sure what the units are in your UTCTime column, as 0118806.0 doesn't look like a unix timestamp or current UTC time. – John Powell Dec 9 '14 at 6:30
  • Loading the data is straightforward, using the copy command, and ST_MakePoint in an update to calculate a geometry column (point), that could be used as a basis for ST_Line_Interpolate_Point. Obviously, if this is dynamic, this update could be put in a trigger, or similar. – John Powell Dec 9 '14 at 6:35
  • 1
    What is the actual output you would like to have? Do you want to have individual frames from the video saved with lat/lon text, or a companion file that shows position for each frame during a video? – Simbamangu Dec 9 '14 at 7:52
  • @JohnBarça, yeah I'm not sure about that column. I suspect it's a seconds-since-epoch that matches the faulty 1970-01-01 date in the other table. So 011806.0 (not 118806) is about 3am UTC, or around 2pm local time (Victoria, Australia). (The two fragments I quoted don't correspond exactly.) – Steve Bennett Dec 10 '14 at 2:58

This isn't exactly what your looking for, but if your comfortable with python i've got a script that takes a gpx file and exif tags photos with location, including interpolating between points, and it could easily be modified to read the GPS data from a format other than gpx.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.