You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The next step is to convert the dataset in to a `SpatialPoints` object with WGS84 project and re-project it into Lambert72. `sp::CRS()` defines the coordinate systems. `sp::coordinates()<-` is an easy way to convert a `data.frame` into a `SpatialPointsDataFrame`, but without specifying a coordinate system. Therefore we need to override the `proj4string` slot with the correct coordinate system. `sp::spTransform()` converts the spatial object from the current coordinate system to another coordinate system.
33
+
The next step is to convert the dataset to a `SpatialPoints` object with WGS84 projection and re-project it to Belgian Lambert72.
34
+
`sp::CRS()` defines the coordinate reference systems (CRS).
35
+
`sp::coordinates()<-` is an easy way to convert a `data.frame` into a `SpatialPointsDataFrame`, but without specifying a CRS.
36
+
Therefore we need to override the CRS with the correct one.
34
37
35
-
```{r reproject}
38
+
`sp` will derive a 'WKT2 string' representation from an EPSG-code [^epsg] that we provide, in order to represent the CRS.
39
+
The WKT2 string (well known text) is a recent open standard by the Open Geospatial Consortium to represent a CRS, and it replaces the older (deprecated) 'PROJ.4 string'.
40
+
Currently, the function to set the CRS is still called `proj4string()`.
41
+
`sp::spTransform()` converts the spatial object from the current CRS to another CRS.
42
+
43
+
[^epsg]: Most coordinate reference systems have an [EPSG](https://en.wikipedia.org/wiki/International_Association_of_Oil_%26_Gas_Producers#European_Petroleum_Survey_Group) code which you can find at http://epsg.io/.
44
+
45
+
```{r crs-objects}
36
46
library(sp)
37
47
crs_wgs84 <- CRS(SRS_string = "EPSG:4326")
38
48
crs_lambert <- CRS(SRS_string = "EPSG:31370")
49
+
```
50
+
51
+
The warning above once again demonstrates that some PROJ.4 information is not supported anymore.
52
+
53
+
```{r reproject}
39
54
coordinates(points) <- ~lon + lat
40
55
# proj4string() - still the only available function to set the CRS - may in the
0 commit comments