How to create a KML file using R

前端 未结 4 1947
梦如初夏
梦如初夏 2021-02-02 16:35

I have written a R script to get some map point data (Latitude and Longitude values). I am able to plot them in R and visualize them. But now I want to generate a KML file from

4条回答
  •  孤城傲影
    2021-02-02 16:58

    If you're willing to step outside R, there is a free program called DNRGarmin can take a comma separated file as a .txt and convert it to .kml for import into google earth.

    You can find it here:

    http://www.dnr.state.mn.us/mis/gis/tools/arcview/extensions/DNRGarmin/DNRGarmin.html

    so in R:

    my.geo.data <- all.my.data[ c("unique.id", "lats", "longs")]
    
    write.csv( my.geo.data, file = "myGeoData.txt")
    

    open DNRGarmin,

    File -> Load From -> File -> myGeoData.txt Then, File -> Save to -> File -> myGeoData.kml

    @rcs's advice re: WGS84 applies for this answer too.

    Good luck

提交回复
热议问题