I've been working on an analysis involving animal vehicle collisions. The data has been passed to r-stats and I keep noticing peculiar things in the cross referencing of the data. I've created highway segments of interest and created a buffer around these. I used the join attributes by location so that I could cross reference the Segment ID onto the Wildlife Collision Data. The Wildlife Collision Data are points that identify the date of a collision and what animal was involved. The highway segments were created using KDE+ software and they are hotspot segments and coldspot segments. The details are not so important other than to note that each hotspot or coldspot segment has a Segment ID and that is the information I need to be tied to the Wildlife Collision Data.
I've tried several options - different geometric predicates, selecting different fields to add, different joint type (one-to-many v. one-to-one), and so on. I still get errors in the data. The figure below shows the buffered polygon and the points of wildlife collision data contained within.
I know there is a mistake in QGIS because I select the animal column, for example, and note that there are NA's in the in the table of joined output layer. I sort by the segment ID and then select all the data for that segment. If I zoom to that segment I can select the wildlife records to cross compare. The data is inconsistent.
The figure below shows the resulting data table that lists "HORSE" as one of the animals occurring in the segment, but this is FALSE. There's 18 actual wildlife collision records in the segment selected in the figure shown (name = KDE 43 10), but only 14 results total. There is no HORSE in that segment, but there are records of ELK yet the output doesn't catch these records. Furthermore, some of the joined rows give no output in the view pane. If I select some rows and zoom to selection, I get nothing. There's nothing in these.
I don't know if this is a bug that should be reported and I've never reported a bug. I thought I would post this to see if I'm missing something here.
One thing I've learned is that projection errors are often a likely cause. I decided to look at this data in an older version - QGIS 2.18 - and discovered that the wildlife record layer was not projected correctly. Okay...I fixed the projection. In QGIS 3 it said it had the correct projection and the data fit exactly where it was supposed to fit. I thought that this might be the source of the problem, but the same issue occurs in a re-run of the join attributes. I summarized more detail in the output and you can see in the figure below that the data table in the output records DEER in the appended animal_2 field where it is listed as a HORSE or MOOSE in the animal field. Nothing is making sense.