<div dir="ltr"><div>Hi Bernd,</div><div>Hum.. interesting. Assuming you have two layers: <b>tracks (id_track, date_track)</b> and
<b>birds(id_bird, date_bird)</b>, the idea is to get the id of the highest among the date_track(s) lower than the date_bird for each bird. Am I right?<br></div><div> I gave it a shot and i think i have some working expression. Here I display the matching track id in birds labels<br></div><div><br>attribute(<br> get_feature ( 'tracks',</div><div> 'date_track',<br> aggregate( layer:='tracks',<br> aggregate:='max',<br> expression:="date_track",<br> filter:="date_track"< attribute(@parent, 'date_bird')<br> )<br> ),<br> 'id_track'</div><div>)<br></div><div><br></div><div>I used temporary layers with datetime field.</div><div>Now, without sample of dataset to actually see the date formatting issue you were afraid of...</div><div><br></div><div>Hope that helps,</div><div>Harrissou<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le ven. 17 mai 2019 à 20:34, Bernd Vogelgesang <<a href="mailto:bernd.vogelgesang@gmx.de">bernd.vogelgesang@gmx.de</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Mike,<br>
<br>
thank you for your hint, but the distance between the point and the<br>
track is of no relevance for me.<br>
<br>
It seems that the screenshot I posted is a bit misleading<br>
(<a href="https://i.stack.imgur.com/MqPhK.jpg" rel="noreferrer" target="_blank">https://i.stack.imgur.com/MqPhK.jpg</a>). Seems I picked a point where the<br>
associated trackpoints are also the closest ones. But the information we<br>
need is the time, where the observer was when taking the observation.<br>
And this might also be on a more distant location.<br>
<br>
Furthermore, I do not intend to create a new layer. I'm just looking for<br>
a way to highlight the track point(s) which compare best by time with<br>
the selected observation point.<br>
<br>
So, still coulnd't find out how to query points in another layer through<br>
an expression/ function, and in case I'll find out, how to compare it<br>
with datetime values.<br>
<br>
Cheers,<br>
<br>
Bernd<br>
<br>
Am 16.05.19 um 13:28 schrieb Mike Flannigan:<br>
><br>
> Hi,<br>
><br>
> I'm thinking this is easier done outside of QGIS, but if you<br>
> want to do in within QGIS this is one way:<br>
> <a href="https://www.qgistutorials.com/en/docs/nearest_neighbor_analysis.html" rel="noreferrer" target="_blank">https://www.qgistutorials.com/en/docs/nearest_neighbor_analysis.html</a><br>
><br>
><br>
> Mike<br>
><br>
><br>
> On 5/15/2019 1:17 PM, <a href="mailto:qgis-user-request@lists.osgeo.org" target="_blank">qgis-user-request@lists.osgeo.org</a> wrote:<br>
>> Hi folks,<br>
>> I'm sure there must be some "easy" solution, but hours of searching<br>
>> provided no examples I could learn from to develop a solution:<br>
>><br>
>> I have a point layer of bird observations and a GPS-track recorded while<br>
>> observing the birds in an area.<br>
>> For the interpretation of the findings it would be good to easily find<br>
>> out, from which position the recorded observation was taken.<br>
>><br>
>> My idea was to compare the timestamp of the bird point with the<br>
>> timestamps of the track points, but I run into huge obstacles right at<br>
>> start:<br>
>> I know that I "could" query across layers by the expression aggregate().<br>
>> Unfortunately, the docs on that is so sparse, that I have not the<br>
>> slightest idea how to even start with that<br>
>> (<a href="https://docs.qgis.org/testing/en/docs/user_manual/working_with_vector/expression.html?highlight=expression#aggregates-functions" rel="noreferrer" target="_blank">https://docs.qgis.org/testing/en/docs/user_manual/working_with_vector/expression.html?highlight=expression#aggregates-functions</a>)<br>
>><br>
>><br>
>> Ok, in case I could find out how to properly use aggregate, how do I<br>
>> best compare those time stamps?<br>
>> The layers derive from gpx-files and QGIS identifies the time tag as<br>
>> QDateTime.<br>
>><br>
>> As it is not very likely that a bird observation was recorded at the<br>
>> exact same time as a track point was generated, there is no way to<br>
>> actually compare the values, cause the bird time value will always lie<br>
>> in between two track point values.<br>
>> What kind of query can be used to identify those two trackpoints ?<br>
>><br>
>> In short: How can I identify/highligt/mark track points that have a<br>
>> timestamp close the selected point in another layer?<br>
>><br>
>> I already created a question on this on gis stackexchange with a<br>
>> screenshot,but no reactions so far.<br>
>><br>
>><br>
>> Thankful for any hint<br>
>> Bernd<br>
><br>
_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></blockquote></div>