Click here for the PDF:
Click here for the PDF:
How to Query KML point data as CSV using QGIS and R
Here you can see more than 800 points, each describing an observation of an individual bird. This data is in the form of KML, a sort of XML document from Google for spatial data.
I want to know which points have “pair” or “female” in the description text nodes using R. This way, I can quickly make and update a .csv in Excel of only the paired birds (based on color bands).
Even if there was a description string search function in Google Earth Pro (or other organization-centric GIS/waypoint software), this method is more
robust, as I can work immediately with the output as a data frame in R, rather than a list of results.
First, open an instance of QGIS. I am running ~2.8 on OSX. Add a vector layer of your KML.
“Command-A” in the point dialog to select all before import!
Next, under “Vector”, select “Merge vector layers” via Data Management Tools.
Select CSV and elect to save the file instead of use a temporary/scratch file (this is a common error).
Open your csv in Excel for verification!
The R bit:
# query for paired birds #EDIT: Libraries library(data.table) library(tidyverse) data <- data.frame(fread("Bird_CSV.csv")) pair_rows <- contains("pair", vars = data$description) fem_rows <- contains("fem", vars = data$description) result <- combine(pair_rows, fem_rows) result <- data[result,] write_csv(result, "Paired_Birds.csv")
I’ll let the photos to the talking: welcome to my world! 🙂 !!!!
The field season has officially started in Northern NH!
Male Common Yellowthroat warbler (COYE): This fellow is defending a small territory in a patch of open thicket. These warblers rely on early succession forest- patches of substrate that haven’t really grown in yet- to build cryptic, ground-level nests. They develop complex systems to divert/confuse predators away from their nests.
Female Black-throated Blue Warbler (BTBW): I was lucky to see this female. She is paired with a male who defends a large mature forest territory. They have quite a few BTBW neighbors, which makes for a lot of skirmishes among the males over land. The females are often silent and move very fast…
Male Mourning Warbler (MOWA): This is a rare bird here. Even more amazing, it is defending a territory in our research site- and trying to chase out a male COYE while doing so. The two species “share” resources, which means thy can’t stand each other. 🙂 Each time the male COYE sings near the MOWA, it gets berated and chased away- and vice versa. It appears the COYE isn’t budging either, probably because it hasn’t had this domestic, neighborly problem before.