[Qgis-user] Query cross-table "similar" time stamps?

DelazJ delazj at gmail.com
Sat May 18 02:42:53 PDT 2019


Hi Bernd,
Hum.. interesting. Assuming you have two layers: *tracks (id_track,
date_track)* and *birds(id_bird, date_bird)*, 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?
I gave it a shot and i think i have some working expression. Here I display
the matching track id in birds labels

attribute(
  get_feature ( 'tracks',
                      'date_track',
                      aggregate( layer:='tracks',
                                      aggregate:='max',
                                      expression:="date_track",
                                      filter:="date_track"<
attribute(@parent, 'date_bird')
                                  )
                 ),
  'id_track'
)

I used temporary layers with datetime field.
Now, without sample of dataset to actually see the date formatting issue
you were afraid of...

Hope that helps,
Harrissou

Le ven. 17 mai 2019 à 20:34, Bernd Vogelgesang <bernd.vogelgesang at gmx.de> a
écrit :

> Hi Mike,
>
> thank you for your hint, but the distance between the point and the
> track is of no relevance for me.
>
> It seems that the screenshot I posted is a bit misleading
> (https://i.stack.imgur.com/MqPhK.jpg). Seems I picked a point where the
> associated trackpoints are also the closest ones. But the information we
> need is the time, where the observer was when taking the observation.
> And this might also be on a more distant location.
>
> Furthermore, I do not intend to create a new layer. I'm just looking for
> a way to highlight the track point(s) which compare best by time with
> the selected observation point.
>
> So, still coulnd't find out how to query points in another layer through
> an expression/ function, and in case I'll find out, how to compare it
> with datetime values.
>
> Cheers,
>
> Bernd
>
> Am 16.05.19 um 13:28 schrieb Mike Flannigan:
> >
> > Hi,
> >
> > I'm thinking this is easier done outside of QGIS, but if you
> > want to do in within QGIS this is one way:
> > https://www.qgistutorials.com/en/docs/nearest_neighbor_analysis.html
> >
> >
> > Mike
> >
> >
> > On 5/15/2019 1:17 PM, qgis-user-request at lists.osgeo.org wrote:
> >> Hi folks,
> >> I'm sure there must be some "easy" solution, but hours of searching
> >> provided no examples I could learn from to develop a solution:
> >>
> >> I have a point layer of bird observations and a GPS-track recorded while
> >> observing the birds in an area.
> >> For the interpretation of the findings it would be good to easily find
> >> out, from which position the recorded observation was taken.
> >>
> >> My idea was to compare the timestamp of the bird point with the
> >> timestamps of the track points, but I run into huge obstacles right at
> >> start:
> >> I know that I "could" query across layers by the expression aggregate().
> >> Unfortunately, the docs on that is so sparse, that I have not the
> >> slightest idea how to even start with that
> >> (
> https://docs.qgis.org/testing/en/docs/user_manual/working_with_vector/expression.html?highlight=expression#aggregates-functions
> )
> >>
> >>
> >> Ok, in case I could find out how to properly use aggregate, how do I
> >> best compare those time stamps?
> >> The layers derive from gpx-files and QGIS identifies the time tag as
> >> QDateTime.
> >>
> >> As it is not very likely that a bird observation was recorded at the
> >> exact same time as a track point was generated, there is no way to
> >> actually compare the values, cause the bird time value will always lie
> >> in between two track point values.
> >> What kind of query can be used to identify those two trackpoints ?
> >>
> >> In short: How can I identify/highligt/mark track points that have a
> >> timestamp close the selected point in another layer?
> >>
> >> I already created a question on this on gis stackexchange with a
> >> screenshot,but no reactions so far.
> >>
> >>
> >> Thankful for any hint
> >> Bernd
> >
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20190518/796d8ef6/attachment.html>


More information about the Qgis-user mailing list