Using R to Create Maps for GIS Shape File

If you are new to the R programming language, like I am, you may not realize that ESRI GIS Shape files, which are used to do map layering with Latitude and Longitude coordinates, can be plotted in R. You will need to load the following packages:

library(rgdal) Bindings for Geospatial Data Package

library(rgeos): Interface to Geometry Engine

library(maptools) Spatial Tools

library(ggplot2): Popular plotting package

Coding requires pointing the R code to the directory of the shape files and other dependencies. The following data is from a GIS documents (Shapefiles and dependencies) for geospatial layers from Antarctica.

map <- readOGR(dsn="../GIS",layer="gis_osm_natural_a_free_1",verbose=FALSE)
map_wgs84 <- spTransform(map, CRS("+proj=longlat +datum=WGS84"))
write.csv(map_wgs84, "../GIS/gis_osm_natural_a_free_2.csv", row.names=TRUE)
plot(map_wgs84, axes=TRUE)

2 thoughts on “Using R to Create Maps for GIS Shape File

  1. I have prepared the maps of my soil sampling points (in the boundary
    of my study site), maps of DEM and DEM derivatives, interpolation maps
    of soil particle size distribution and Bulk density; and also
    interpolation maps of soil pH, CEC, TEB, PBS, OC, and TN; Land
    use/cover, soil surface temperature and geologic map of the study
    site. I have classified the soil types by using WRB techniques at the
    fourth level(with principal and supplementary
    qualifier) and the result showed five different soil types. From these
    predictor variables I want to produce digital soil map.

    Would you please help me on how to import these shapefile and raster
    data into R, overlay produce a map (by using GLGM)?
    With best regards,

    • Hi, thank-you for the question and comment. Unfortunately, I have not used GLGM in R or have done overlays. Mostly what I have done is just done mapping of coordinates with other metrics. But I’ve now very interested in what you’ve done and I will look into it because now I’m interested. I’ll keep you updated!

Leave a Reply