I have a spreadsheet with data in format shown below and want to load in QGIS as WKT file for a Temporal animation. I have checked in Wikipedia but there are no examples of Linestring with date and no info on file extension txt, csv or other. I have seen an example here Showing a Linestring table but with no explanation of the significance of the "oid,Line" first line. Any pointers?

I now have the gist of what I need to do but need to wrangle the data (400 odd lines) into the format required. The data was originally extracted from a kml file so there is a single line with caret p between every lat/lon it will take a long time to manually edit the file or to edit the csv into pairs. Any ideas?

Sample data

Geometry                      Date
-16.6982869,12.87235076       2022/12/30  09:10
-16.69823065,12.8708152       2022/12/30  09:11
-16.69823065,12.86927963      2022/12/30  09:12
-16.6982869,12.86752468       2022/12/30  09:13
-16.69823065,12.86598909      2022/12/30  09:14
-16.69856818,12.86494708      2022/12/30  09:15

  • 3
    You've got single point coordinates (X Y). You need at least two points to make a linestring(X1 Y1, ..., Xn Yn).
    – user2856
    Jan 9 at 12:44
  • 2
    WKT definitions can be found here. They are just strings, no oid or whatever. Linestring formats are : LINESTRING (X1 Y1,X2 Y2) or more pairs of points Linestring formats are : LINESTRING (X1 Y1,X2 Y2,...,Xn Yn) In the case of your prior question where I suggested WKT, you shoud create WKT strings like LINESTRING (currentX currentY,nextX nextY). For instance in your geometry column you want to have: LINESTRING (-16.6982869 12.87235076 ,-16.69823065 12.8708152) for the first line. Leave the Date as such (not wkt)
    – Kasper
    Jan 9 at 12:58
  • Perhaps you could animate your data as points. Select all the points before some date and color them. The last point might have a different color. Imagine that a red dot is moving on the map and leaves a green dotted tail after.
    – user30184
    Jan 9 at 15:02
  • I have already made a dot animation but am trying to do it more elegantly as an moving line.
    – Vic
    Jan 10 at 10:49

1 Answer 1


@Vic your date field is merely a separate data field and irrelevant to Well Known Text (WKT), which is just one of many standardized ways of representing feature geometry.

The oid field in your example is merely a feature identifying unique id value. Depending where you look in the wild, you'll find these have many aliases: oid, fid, ogc_fid, feature_id, etc. But they're all the same thing. Sometimes you'll get really lucky ::cough::SARCASM::cough:: and find two or three of these in the same file. In that case you'd probably want to use the field that has hopefully both the smallest (1) and the largest (n) value. But, still, you could name this field whatever you want.

Also in your example, the Line field is where they have stored the WKT geometry, but again, this could go by any name. And in the wild you'll see several common variations, shape, geom, the_geom (sigh), ogc_geometry, etc. Personally, I like to use the pattern geom_{SRID}, which if your coordinates are in WGS84 would be either geom_4326 or alternatively, geom_wgs84. But you can call it whatever you want.

[Of note: As one of the commenters mentioned, your data appears to be points, and not lines. But maybe you already know that and right now you're just concerned about getting the WKT format and import working?]

Looking at QGIS, you'd probably want to use the Delimited Text dialog to add your file. Find it at: Layer (menu) > Add Layer > Vector > Delimited Text (left side)

In that dialog, select the Well Known Text radio option (middle). Then click on the Geometry Field, which has hopefully auto-populated all of your fields, and choose whatever fieldname you provided for your WKT geometries in your spreadsheet. Then set the additional options for type (Line, I guess?) and CRS (probably EPSG:4326 unless you know it's in a different system).

enter image description here

Now, if you're spreadsheet is not already in a CSV or some other delimited format, you'll want to use your preferred spreadsheet software to convert it from whatever its current file type is to a CSV (or TSV, etc).

When it's all said and done, your date field should be represented as a stand-alone field in your dataset, and after you add the layer in QGIS, it should be represented as such in the attribute view, or in the info popup when you click on a feature.

  • Complete answer, this might confuse @Vic a bit more, the background being this question. Vic just needs to generate 2 point WKT LInestrings for each date (current to next point), I provided an example in the Comments
    – Kasper
    Jan 9 at 12:57

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.