How to import kml file into R and make nice table


I download kml file here:

Does anyone knows how to import it (kml file) to R and create nice table that would be able to merge with other data-sets?


The sf package is a really great way to work with spatial data in R. You can use the st_read() function to import many spatial file formats like KML, GeoJSON, and shapefiles into R.

One great thing about the sf package is that you can use tidyverse tools like dplyr to join and manipulate the spatial data in the same way you work with non-spatial data frames in R. Below, I import the CCG region KML file and then plot it.

#> Linking to GEOS 3.6.1, GDAL 2.1.3, PROJ 4.9.3

ccg <- st_read("")
#> Reading layer `OGRGeoJSON' from data source `' using driver `KML'
#> Simple feature collection with 207 features and 2 fields
#> geometry type:  MULTIPOLYGON
#> dimension:      XY
#> bbox:           xmin: -6.418524 ymin: 49.86474 xmax: 1.762942 ymax: 55.81107
#> epsg (SRID):    4326
#> proj4string:    +proj=longlat +datum=WGS84 +no_defs


Created on 2018-12-07 by the reprex package (v0.2.1)


This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.