Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

sorry íf I might ask this question the 101 time, but I didn't found anything with google or SE.

I have a CSV file with WGS84 trackpoints and visualizing them with QGIS textplugin works fine. The log interval is 1sec and I like to get the current speed to get a visual feedback, how fast the vehicle was between two points (so distance/time). Any idea how I can realize this with a style?

share|improve this question

I can imagine a solution using a SpatiaLite database provided each trackpoint has some sequential id number. First import your CSV file into spatialite (plenty of sources available to explain this step) then make it a spatial layer: (I assume the CSV has columns longitude, latitude for the GPS locations, and a column 'id' with the sequential numbering of the trackpoints)

SELECT AddGeometryColumn('trackpoints','geometry',4326,'POINT','XY');
UPDATE trackpoints SET geometry=MakePoint(longitude, latitude, 4326);

Now you have a spatial point layer with each point numbered along the track. Add a column to contain the distance from each point to the next one:

ALTER TABLE trackpoints ADD COLUMN dist real;

Now to get the distance between each pair of points, make a line segment from a pair and use the GeodesicLenght() function to get distance in meters. Here's how it would be done:

UPDATE trackpoints SET dist=(
SELECT GeodesicDistance(MakeLine(trackpoints.geometry, tp1.geometry)) 
FROM trackpoints AS tp1

Now the dist column should contain for each point the distance to the next. Finally. divide dist by the time interval between points, and you should have the speed...

share|improve this answer
Thanks Micha! I just expected that there is an buildin feature as most GPX viewers have. I will try your approach! – Mapper Oct 16 '13 at 18:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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