I'm hoping to analyze google timeline data in R for a final project in a GIS class,
Google can output timeline data as geojson and KML but it looks like the KML file includes a lot more info (type of transportation distance traveled etc) than the JSON file. Additionally, JSON is an option for the entire time lines but to download a single day/week/month it looks like I have to use KML.
I understand from
How to efficiently read a kml file into R
Importing KML files to R
that I need to specify the layer info as well as the kml file name to
readOGR(), what I'm a little confused about is exactly how the layer names are included in a kml file.
Looks like the
<name> tag is associated with the layer name, but there are 122 name tags in the file so its clearly not exclusive to layer. Fine.
layers <- ogrinfo(data_source) gets me
 "INFO: Open of `C:\\Users\\Documents\\GIS_Coursework_3\\history-2018-09-28.kml'"
 " using driver `LIBKML' successful."
 "1: Location history from 2018-09-28 to 2018-09-28 "
Location_History <- readOGR(data_source, "Location history-2018-09-28 to 2018-09-28 ") gives:
Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv, :
Multiple incompatible geometries: wkbPoint: 12; wkbLineString: 12
The problem is that there are multiple "sub" layers,
in QGIS i can see that when I open the layer, there is a points layer and a lines layer
I dont' see either of these text strings in the KML files anywhere when I open it as a text file.
I could probably just copy those, but it's not particularly useful to me as a one off. I need to get the layer info programmatically, rather than opening QGIS every time.
Is it practical for me to start exploring xml parsing in R?
Is there a package I haven't been able to find that handles this stuff successfully?
Am I missing something obvious about how to read KML layer info?
This is the only feature I've found lacking in R compared to QGIS or ArcGIS. They've been pretty comparable so far which I've found impressive.