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
and
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.
using layers <- ogrinfo(data_source) gets me
[1] "INFO: Open of `C:\\Users\\Documents\\GIS_Coursework_3\\history-2018-09-28.kml'"
[2] " using driver `LIBKML' successful."
[3] "1: Location history from 2018-09-28 to 2018-09-28 "
then using 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.

rgdal::ogrListLayers("foo.kml")do for you? Have you tried reading withsf::st_read, which can probably cope with multiple geometry types? – Spacedman Dec 21 '18 at 15:26ogrListLayers()returns the "top" layer for lack of a better word, similar to whatogrinfo()returns – Hugh_Kelley Dec 21 '18 at 15:29st_read()handles it pretty well, no errors or warnings. data looks ok in the sf object it returns... – Hugh_Kelley Dec 21 '18 at 15:35