Date: Fri, 29 Mar 2024 12:57:47 +0000 (UTC) Message-ID: <253260258.9.1711717067965@a28db5bc14a1> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_8_991727904.1711717067965" ------=_Part_8_991727904.1711717067965 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
A Coordinate Reference Systems (CRS) is a coordinate-based scheme use to= locate entities in geographical space. It is an essential aspect of spatia= l data.
CRS can be stored in many different formats. The most common formats are= :
Set a CRS
Functions of R spatial packages can be used to set (and retrieve) the CR= S of spatial object. Note that these functions add CRS information to spati= al objects, but they do not change their projections. Thus, you need to be = sure that you are assigning the correct CRS to your spatial object.
Change a CRS
The =E2=80=98projectRaster=E2=80=99 function in the =E2=80=98raster=E2= =80=99 package is used to project the values of a Raster* object to a new R= aster* object with another projection (i.e. CRS). This can be done by:=
EXAMPLES
Examples on how to set and change the CRS of raster/polygon objects are = provided below. The examples are taken from the =E2=80=9CEffects of Cyclone= Yasi on Green Cover at Mission Beach=E2=80=9D tutorial.Putting the code sn= ippets in context, by looking at a broader section of the R script, could b= e benefitial. Boxes with grey backgr= ound contain code snippets, and boxes with white background containt&nb= sp;code (text) outputs. For more details on CRS and = CRS operations, see TERN.s DSDP "Using Raster Data in R" tutorial.
Define a CRS
Below we first create a SpatialPolygons* object for the Study Area in th= e =E2=80=9CEffects of Cyclone Yasi on Green Cover at Mission Beach=E2=80=9D= tutorial. This polygon does not have a CRS, so we provide an appropriate o= ne. We use the EPSG:4326, which is the EPSG code for geographic coordinates= on the WGS84 datum. This is a general spatial reference (i.e. area: W= orld; scope: Horizontal component of 3D system). It is used by GPS satellit= e navigation systems and NATO military geodetic surveying). For more detail= s see this spatialreferece.org link.
#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
# Study Area
#=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D
# Define Spatial '=
Extent' of Study Area: Mission Beach backdrop
# ----------------=
----------------------------------------------
StudyArea.extent =3D extent(146.0333, 146.0833, -17.9333, -17.8583)
# Create a working=
spatial structure from the spatial 'Extent'
# ----------------=
--------------------------------------------
# Create a 'Spatia=
l Polygon' from Spatial 'Extent'
StudyArea.SP =3D as(StudyArea.extent, "SpatialPolygons")
StudyArea.SP # Has=
not CRS
## class : SpatialPolygons=20
## features : 1=20
## extent : 146.0333, 146.0833, -17.9333, -17.8583 (xmin, xmax, ymin,=
ymax)
## coord. ref. : NA
# Add a CRS. Use: EPSG:4326 =3D 'WGS84' - General Spati=
al Reference (https://spatialreference.org/ref/epsg/wgs-84/).
proj4string(StudyArea.SP) =3D CRS("+init=3Depsg:4326") # Add CRS
StudyArea.SP # Has=
a EPSG:4326 CRS
## class : SpatialPolygons=20
## features : 1=20
## extent : 146.0333, 146.0833, -17.9333, -17.8583 (xmin, xmax, ymin,=
ymax)
## coord. ref. : +init=3Depsg:4326 +proj=3Dlonglat +datum=3DWGS84 +no_defs =
+ellps=3DWGS84 +towgs84=3D0,0,0
Change a CRS
Below we reproject a set of raster objects from their Australian-specifi= c CRS (EPSG:3577=3D =E2=80=98GDA94=E2=80=99 =3D =E2=80=98Australian Albers= =E2=80=99) to a general world CRS (EPSG:4326 =3D =E2=80=98WGS 84=E2=80=99),= so that it can better compared to
downloaded Stamen Maps for the region.
# Reproject Rasters to EPSG:4326 (general spatial CRS w=
ith coordinates on the WGS84
# datum on the Sta=
men Maps)
# ----------------=
-------------------------------------------------------------------
# SPGC Study Area =
2010 Winter
SPGC.StudyArea.2010q3.reprj.rl =3D projectRaster(SPGC.StudyArea.2010q3.rl, =
crs=3DCRS("+init=3D=
epsg:4326"))
# SPGC Study Area =
20101Winter
SPGC.StudyArea.2011q3.reprj.rl =3D projectRaster(SPGC.StudyArea.2011q3.rl, =
crs=3DCRS("+init=3D=
epsg:4326"))
# SGGC Study Area =
2010 Winter
SGGC.StudyArea.2010q3.reprj.rl =3D projectRaster(SGGC.StudyArea.2010q3.rl, =
crs=3DCRS("+init=3D=
epsg:4326"))
# SGGC Study Area =
2011 Winter
SGGC.StudyArea.2011q3.reprj.rl =3D projectRaster(SGGC.StudyArea.2011q3.rl, =
crs=3DCRS("+init=3D=
epsg:4326"))
# SPGC Study Area =
Difference between Winters of 2011 and 2010
SPGC.StudyArea.Diffq3.reprj.rl =3D projectRaster(SPGC.StudyArea.Diffq3.rl, =
crs=3DCRS("+init=3D=
epsg:4326"))
# SGGC Study Area =
Difference between Winters of 2011 and 2010
SGGC.StudyArea.Diffq3.reprj.rl =3D projectRaster(SGGC.StudyArea.Diffq3.rl, =
crs=3DCRS("+init=3D=
epsg:4326"))