@@ -578,38 +578,35 @@ functions are limited to PostGIS.
578
578
579
579
## Coordinate reference systems and transformations {#crs}
580
580
581
- Coordinate reference systems (CRS) are like measurement units for
582
- coordinates: they specify which location on Earth a particular
583
- coordinate pair refers to. We saw above that ` sfc ` objects
584
- (geometry list-columns) have two attributes to store a CRS: ` epsg `
585
- and ` proj4string ` . This implies that all geometries in a geometry
586
- list-column must have the same CRS. Both may be ` NA ` , e.g. in case
587
- the CRS is unknown, or when we work with local coordinate systems
588
- (e.g. inside a building, a body, or an abstract space).
589
-
590
- ` proj4string ` is a generic, string-based description of a CRS,
581
+ Coordinate reference systems (CRS) are like measurement units
582
+ for coordinates: they specify which location on Earth a particular
583
+ coordinate pair refers to. We saw above that ` sfc ` objects (geometry
584
+ list-columns) have a an attribute of class ` crs ` that stores the
585
+ CRS. This implies that all geometries in a geometry list-column
586
+ have the same CRS. It may be ` NA ` in case the CRS is unknown, or
587
+ when we work with local coordinate systems (e.g. inside a building,
588
+ a body, or an abstract space); in that case coordinates are assumed
589
+ to be Cartesian (in case of 2D: defining positions on in a flat
590
+ plane).
591
+
592
+ A ` crs ` object contains two character fields: ` input ` for the
593
+ name (if existing) or the user-definition of the CRS, and ` wkt `
594
+ for the WKT-2 specification; WKT-2 is a standard encoding for
595
+ describing CRS that is used throughout the spatial data science
596
+ industry. When defining a CRS, a PROJ string may be used that is
591
597
understood by the [ PROJ] ( https://proj4.org/ ) library. It defines
592
598
projection types and (often) defines parameter values for particular
593
599
projections, and hence can cover an infinite amount of different
594
- projections. This library (also used by GDAL) provides functions
595
- to convert or transform between different CRS. ` epsg ` is the
596
- integer ID for a particular, known CRS that can be resolved into a
597
- ` proj4string ` . Some ` proj4string ` values can resolved back into
598
- their corresponding ` epsg ` ID, but this does not always work.
599
-
600
- The importance of having ` epsg ` values stored with data besides
601
- ` proj4string ` values is that the ` epsg ` refers to particular,
602
- well-known CRS, whose parameters may change (improve) over time;
603
- fixing only the ` proj4string ` may remove the possibility to benefit
604
- from such improvements, and limit some of the provenance of datasets,
605
- but may help reproducibility.
606
-
607
- Coordinate reference system transformations can be carried out using
600
+ projections. Alternatively, codes like ` EPSG:3035 ` or ` OGC:CRS84 `
601
+ may be used; these are well-known identifiers of CRS defined in
602
+ the PROJ database.
603
+
604
+ Coordinate reference system transformations are carried out using
608
605
` st_transform() ` , e.g. converting longitudes/latitudes in NAD27 to
609
606
web mercator (EPSG:3857) can be done by:
610
607
611
608
``` {r}
612
- nc.web_mercator <- st_transform(nc, 3857)
609
+ nc.web_mercator <- st_transform(nc, "EPSG: 3857" )
613
610
st_geometry(nc.web_mercator)[[4]][[2]][[1]][1:3,]
614
611
```
615
612
0 commit comments