Skip to main content
1 of 4

How to extract non-spatial data from an imported KML file using R

I have a KML file which was created using Google's My Maps. The original file can be downloaded here: Google My Maps

Using R, I can import this using the "readOGR" function of the rgdal library This brings the KML file in as a SpatialPointsDataFrame (SPDF) - which i am calling asf52

![RStudio Data Pane

In this SPDF, the spatial data is contained under @coords and is readily extracted into a dataframe using code like

df  <- data.frame(asf52@coords[,1:2])

However, I am struggling to come up with a way to neatly extract the the non-spatial data - contained under @Description - and turn it into a dataframe with a column for each variable.

Thanks in advance