Skip to content
Prev 7134 / 29559 Next

convert KML file into shape file or CSV file

rusers.sh wrote:
The way to do it in R is with the rgdal library (install.packages("rgdal")

-- psuedo code --
library(rgdal)
readOGR("pathtofile",layer.kml)
writeOGR("pathtooutput",driver="ESRI Shapefile",layer=output.shp)
-- end of fake code example --

but if you have the rgdal library that means you also have GDAL/OGR
installed and could just us the command line on your system:
ogr2ogr -f "ESRI Shapefile" nameof.shp file.kml

In this particular case, I tried with the file you linked. Turns out
it's not a valid KML file, at least according to OGC standards.
After failing to get any of my GIS tools to read it I checked it using
http://kmlvalidator.com/home.htm
It returns several Errors.

There's a good chance the file still works in Google Earth but nothing
else seems to be able to figure it out.

Alex