1

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.

Join Attributes by Location Panel with polygons in the background

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.

Output polygon of joined attributes annotated to show the error

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.

Data table showing more details on the output

2
  • 2
    How did you fix the projection? Use "save as" or "export" to reproject your data correctly. When now both have the same projection you can use "contains" on "join attributes by location".
    – MrXsquared
    Dec 9, 2018 at 19:47
  • I used the reproject layer function. This wasn't my problem though - I posted an answer below. Perhaps I should just delete this whole question. It was a stupid error I made in the buffer layer. A whole morning wasted on a silly mistake. Dec 9, 2018 at 19:49

1 Answer 1

1

I solved my problem. The buffer layer that had the segment information had other fields with data that was false and conflicting. The buffer layer was created earlier in the process by trying to intersect with other project information and the the false information was carried forward. I'm going to leave this posted here as a lesson in both humility and so others might be warned to check the content of all the layers! I just assumed that the buffer layer was created correctly while I was focused on the data of interest.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.