<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Brent,<br>
<br>
I was so focussed on trying to use labelling that I didn't think
of other options, such as you suggested:) The two files method
does the job, and matches the hacky way that the original file
generated...<br>
<br>
I see some discussion of adding aggregate functions on top of
QgsExpression [1], which as I understand it, would make such
functions available for use in the labelling dialog. I could then
do something elegant like datetime = max(datetime) to select the
most recent datapoint...<br>
<br>
Regards<br>
<br>
Gavin<br>
<br>
[1] Towards the end of:
<a class="moz-txt-link-freetext" href="https://groups.google.com/forum/#!topic/qgis-developer-remote/3pWsSyYSd9s">https://groups.google.com/forum/#!topic/qgis-developer-remote/3pWsSyYSd9s</a><br>
<br>
On 11/03/2014 5:35 a.m., Brent Wood wrote:<br>
</div>
<blockquote
cite="mid:1394512538.4605.YahooMailNeo@web121203.mail.ne1.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff; font-family:arial,
helvetica, sans-serif;font-size:12pt">
<div><span>Hi Gavin,</span></div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
arial,helvetica,sans-serif; background-color: transparent;
font-style: normal;"><br>
<span></span></div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
arial,helvetica,sans-serif; background-color: transparent;
font-style: normal;"><span>Can you have the row written to two
files concurrently? One as an append & one overwrite.</span></div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
arial,helvetica,sans-serif; background-color: transparent;
font-style: normal;"><span> </span><span><span>Both watched
in QGIS</span> & have the overwrite as the upper layer
on the map with a different symbol, thus overwriting the
trackline point in the append csv file.</span></div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
arial,helvetica,sans-serif; background-color: transparent;
font-style: normal;"><br>
<span></span></div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
arial,helvetica,sans-serif; background-color: transparent;
font-style: normal;"><span>Not as elegant as an SQL solution,
but csv's are not really reknowned for their elegance in
data management :-)</span></div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
arial,helvetica,sans-serif; background-color: transparent;
font-style: normal;"><br>
<span></span></div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
arial,helvetica,sans-serif; background-color: transparent;
font-style: normal;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
arial,helvetica,sans-serif; background-color: transparent;
font-style: normal;">I haven't really thought this through,
but you might try using a named pipe (see mkfifo on Linux,
Windows has something along these lines too), & run "tail
-n 1 -f myfile.csv" into the named pipe, then open this in
QGIS. This is such a horrible solution it's almost certain not
to work, but you never know :-) <br>
<span></span></div>
<div><br>
</div>
<div><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
arial,helvetica,sans-serif; background-color: transparent;
font-style: normal;">Cheers,</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
arial,helvetica,sans-serif; background-color: transparent;
font-style: normal;"><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
arial,helvetica,sans-serif; background-color: transparent;
font-style: normal;"> Brent<br>
</div>
<div style="font-family: arial, helvetica, sans-serif;
font-size: 12pt;">
<div style="font-family: times new roman, new york, times,
serif; font-size: 12pt;">
<div dir="ltr">
<hr size="1"> <font face="Arial" size="2"> <b><span
style="font-weight:bold;">From:</span></b> Gavin
Macaulay <a class="moz-txt-link-rfc2396E" href="mailto:gavin@macaulay.co.nz"><gavin@macaulay.co.nz></a><br>
<b><span style="font-weight: bold;">To:</span></b>
<a class="moz-txt-link-abbreviated" href="mailto:qgis-user@lists.osgeo.org">qgis-user@lists.osgeo.org</a> <br>
<b><span style="font-weight: bold;">Sent:</span></b>
Tuesday, March 11, 2014 9:18 AM<br>
<b><span style="font-weight: bold;">Subject:</span></b>
[Qgis-user] Labelling expressions: how to select the
'last' row in a csv dataset<br>
</font> </div>
<div class="y_msg_container"><br>
Hi,<br>
<br>
I have a csv file that looks like this:<br>
<br>
datetime, latitude, longitude, speed<br>
2014-03-07T06:11:56.794000, 69.6930, 19.0321, 0.0<br>
2014-03-07T06:12:56.791000, 69.6904, 19.0291, 10.0<br>
2014-03-07T06:13:56.787000, 69.6879, 19.0257, 10.0<br>
<br>
A new row gets added to the file every second or so. I
load this file <br>
into QGIS as a csv file with the watch option turned on so
that every <br>
time the map is refreshed, the map plots any new points
that have been <br>
added to the file.<br>
<br>
I would like to have the most recent line in the file
plotted with a <br>
different symbol to the rest (the data represents realtime
data from a <br>
moving ship so it's good to highlight the latest
position). I can almost <br>
do this using the expression based labelling, but not
quite (I can get a <br>
row number, but not the total number of rows, so can't do
something <br>
obvious like: $rownum == $numrows, or $id == max($id)).<br>
<br>
Any suggestions on how I can achieve this? I could move
the data into a <br>
SQL-based layer and choose the last row using an SQL
statement, but the <br>
simplicity of generating the csv files is attractive.<br>
<br>
Thanks<br>
<br>
Gavin<br>
_______________________________________________<br>
Qgis-user mailing list<br>
<a moz-do-not-send="true"
ymailto="mailto:Qgis-user@lists.osgeo.org"
href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br>
<a moz-do-not-send="true"
href="http://lists.osgeo.org/mailman/listinfo/qgis-user"
target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
<br>
<br>
</div>
</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>