![]() 4 There are two types of CRSs: geographic and projected. A CRS consists of one such ellipsoid or geometric model of the shape of the Earth and a datum, which identifies the origin and orientation of the coordinate axes on the ellipsoid, as well as the units of measurement. The non-spherical shape of the Earth, which bulges at the equator, complicates the creation and use of a coordinate reference system or CRS and plethora of complex models have been created in attempts to accurately represent the Earth’s surface. To represent the geographic placement of an object you need two pieces of information: the coordinates of the object and a system of reference for how the coordinates relate to a physical location on Earth. The distinguishing feature of spatial data is that it represents actual locations on Earth. Spatial data and coordinate reference systems ![]() I highlight the differences between the two packages and ultimately discuss some reasons why the R spatial community is moving towards the use of the sf package. The second half of the post uses an example of mapping the locations of letters sent to a Dutch merchant in 1585 to show how to create, work with, and plot sp and sf objects. Therefore, I begin the post with a general overview of spatial data and how sp and sf implement the representation of spatial data in R. In other words, this post provides information that I wish I knew as I learned to work with spatial data in R. It takes the point of view of someone getting into GIS and does not assume that you are working with data that is already in a spatial format. In addition to more explicitly comparing sp and sf, this post approaches the two packages from the starting point of working with geocoded data with longitude and latitude values that must be transformed into spatial data. The perspective that I adopt in this post is slightly different from these resources. The vignettes for sf are also very helpful. The best sources for information about the sp and sf packages that I have found are Roger Bivand, Edzer Pebesma, and Virgilio Gómez-Rubio, Applied Spatial Data Analysis with R (2013) and the working book Robin Lovelace, Jakub Nowosad, Jannes Muenchow, Geocomputation with R, which concentrate on sp and sf respectively. There are a number of good resources on working with spatial data in R. The sf package is meant to supersede sp, implementing ways to store spatial data in R that integrate with the tidyverse workflow of the packages developed by Hadley Wickham and others. The package first appeared on CRAN at the end of 2016 and is under very active development. The sf package implements the simple features open standard for the representation of geographic vector data in R. 3 The package remains the backbone of many packages that provide GIS capabilities in R. The sp package introduced a coherent set of classes and methods for handling spatial data in 2005. The sp and sf packages use different methodologies for integrating spatial data into R. This post will build off of the location data obtained there to introduce the two main R packages that have standardized the use of spatial data in R. In my previous post on geocoding with R I showed the use of the ggmap package to geocode data and create maps using the ggplot2 system. The extent of the geographic capabilities of R is readily apparent from the many packages listed in the CRAN task view for spatial data. Since the early 2000s, an active community of R developers has built a wide variety of packages to enable R to interface with geographic data. The goal of this post is to introduce the basic landscape of working with spatial data in R from the perspective of a non-specialist. 1 My own interest in coding and R began with my desire to dip my toes into geographic information systems (GIS) and create maps of an early modern correspondence network. Using a command-line interface has a steep learning curve, but it has the benefit of enabling approaches to analysis and visualization that are customizable, transparent, and reproducible. ![]() There are advantages and disadvantages to these different types of tools. There are a plethora of tools that can visualize geographic information from full-scale GIS applications such as ArcGIS and QGIS to web-based tools like Google maps to any number of programing languages. The geographic visualization of data makes up one of the major branches of the Digital Humanities toolkit. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |