From 057f25f6c81bffd3a8ccc8f69fe32a7ee93b160c Mon Sep 17 00:00:00 2001 From: Robin Lovelace Date: Fri, 21 Jul 2017 11:12:07 +0100 Subject: [PATCH] Finish draft CRS section. Close #53 --- 02-spatial-data.Rmd | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/02-spatial-data.Rmd b/02-spatial-data.Rmd index 3c30630da..7403b1fc8 100644 --- a/02-spatial-data.Rmd +++ b/02-spatial-data.Rmd @@ -670,7 +670,21 @@ To discover what the 'magic number' `27700` means, we can retrieve the CRS again st_crs(sf_points) ``` -Note that the result shows that the `epsg` has been updated to this code. +Note that the result shows that the `epsg` has been updated. But what does this mean? +The answer can be found in another function, from the **rgdal** library: + +```{r} +crs_codes = rgdal::make_EPSG() +dplyr::filter(crs_codes, code == 27700) +``` + +This shows that the CRS we set was the British National Grid. +Although this result could also have been found by searching online for "[CRS 27700](https://www.google.co.uk/search?q=CRS+27700)", or by plotting it with a command such as `mapview::mapview(sf_points)` and zooming out, the method showed above was useful for delving into the nuts and bolts of how EPSG codes work. +The formula that converts a geographic point into a point on the surface of the Earth is provided by the `proj4string` element of the `crs` (see [proj4.org](http://proj4.org/) for further details): + +```{r} +st_crs(27700)$proj4string +``` ### {-} Pro tip