(02) 坐标系(空间数据科学——R语言应用)
本文由SCY翻译自《Spatial Data Science With Applications in R》第二章
坐标系
“数据不仅仅是数字,它们是带有背景的数字”;“在数据分析中,背景赋予了数据以意义。”[@cobbmoore]
在我们尝试理解点、线、多边形、覆盖层和网格等几何形状之前,回顾坐标系统是有益的,这样我们才能理解一个点的坐标到底反映了什么。对于空间数据而言,观测位置由坐标来表征,而坐标是在坐标系统中定义的。可以使用不同的坐标系统来实现这一点,最重要的区别在于坐标是在二维还是三维空间中定义,这个空间参照正交轴(笛卡尔坐标),或使用距离和方向(极坐标、球面坐标和椭球坐标)。除了观测位置,所有观测都与观测时间相关联,因此时间坐标系统也会简要讨论。首先我们将简要回顾量度,以了解单位和基准是什么。
量度、单位、基准
VIM(“国际计量词汇”,@vim)定义量度为“一个现象、物体或物质的属性,这种属性具有可以用一个数字和参照物表示的大小”,其中“[a]参照物可以是测量单位、测量程序、参照物质或这些的组合。”尽管可以争论所有数据是否都由量度构成,但没有必要争论正确处理数据要求数字(或符号)必须伴随关于它们的含义的信息,尤其是它们指向什么。
一个测量系统由基本单位组成,用于基本量度,以及由衍生单位组成,用于衍生量度。例如,国际单位制[@SI]由七个基本单位组成:长度(米,m)、质量(千克,kg)、时间(秒,s)、电流(安培,A)、热力学温度(开尔文,K)、物质的量(摩尔,mol)和发光强度(坎德拉,cd)。衍生单位由基本单位的整数次幂的乘积组成;例如速度($\mbox{m}~\mbox{s}^{-1}$)、密度($\mbox{kg}~\mbox{m}^{-3}$)和面积($\mbox{m}^2$)。
此翻译保留了原文的专业术语和格式,确保其科学性和准确性。如需进一步翻译或有其他问题,请随时告知。
The special case of unitless measures can refer to either cases
where units cancel out (for instance mass fraction: kg/kg, or angle measured
in rad: m/m) or to cases where objects or events were counted
(such as “5 apples”). Adding an angle to a count of apples would not
make sense; adding 5 apples to 3 oranges may make sense if the
result is reinterpreted in terms of a superclass, in this case as pieces of fruit.
Many data variables have units that are not expressible as SI base
units or derived units. @hand discusses many such measurement scales,
including those used to measure variables like intelligence in
social sciences, in the context of measurement units.
For many quantities, the natural origin of values is zero. This
works for amounts, where differences between amounts result in
meaningful negative values. For locations and times, differences
have a natural zero interpretation: distance and duration. Absolute
location (position) and time need a fixed origin, from which we
can meaningfully measure other absolute space time points: we
call this a datum.
For space, a datum involves more than one dimension. The combination
of a datum and a measurement unit (scale) is a reference system.
\index{datum}
We will now elaborate how spatial locations can be expressed as
either ellipsoidal or Cartesian coordinates. The next sections will
deal with temporal and spatial reference systems, and how they are
handled in R.
Ellipsoidal coordinates
1 | #| out.width: 60% |
@fig-polar shows both polar and Cartesian coordinates
for a two-dimensional situation. In Cartesian coordinates,
the point shown is $(x,y) = (3,4)$, for polar coordinates it is
$(r,\phi) = (5, \mbox{arctan}(4/3))$, where $\mbox{arctan}(4/3)$ is
approximately $0.93$ radians, or $53^{\circ}$. Note that $x$, $y$
and $r$ all have length units, where $\phi$ is an angle (a unitless
length/length ratio). Converting back and forth between Cartesian
and polar coordinates is trivial, as
$$x = r~\mbox{cos} \phi,\ \ \ y = r~\mbox{sin} \phi, \ \mbox{and}$$
$$r = \sqrt{x^2 + y^2}, \ \ \ \phi = \mbox{atan2}(y, x)$$
where $\mbox{atan2}$ is used in favour of $\mbox{atan}(y/x)$ to take care
of the right quadrant.
Spherical or ellipsoidal coordinates
\index{ellipsoidal coordinates}
\index{coordinates!ellipsoidal}
\index{coordinates!geocentric}
\index{coordinates!Cartesian}
In three dimensions, where Cartesian coordinates are expressed as
$(x,y,z)$, spherical coordinates are the three-dimensional equivalent
of polar coordinates and can be expressed as $(r,\lambda,\phi)$, where:
- $r$ is the radius of the sphere,
- $\lambda$ is the longitude, measured in the $(x,y)$ plane counter-clockwise from positive $x$, and
- $\phi$ is the latitude, the angle between the vector and the $(x,y)$ plane.
@fig-sphere illustrates Cartesian geocentric and
ellipsoidal coordinates.
1 | #| fig.cap: "Cartesian geocentric coordinates (left) measure three distances, ellipsoidal coordinates (right) measure two angles, and possibly an ellipsoidal height" |
$\lambda$ typically varies between $-180^{\circ}$ and $180^{\circ}$
(or alternatively from $0^{\circ}$ to $360^{\circ}$), $\phi$ from
$-90^{\circ}$ to $90^{\circ}$. When we are only interested in points
on a sphere with given radius, we can drop $r$: $(\lambda,\phi)$
now suffice to identify any point.
\newpage
It should be noted that this is just a definition, one could for
instance also choose to measure polar angle, the angle between
the vector and $z$, instead of latitude. There is also a long
tradition of specifying points as $(\phi,\lambda)$ but throughout
this book we will stick to longitude-latitude, $(\lambda,\phi)$.
The point denoted in @fig-sphere has $(\lambda,\phi)$ or ellipsoidal
coordinates with angular values
1 | #| code-fold: true |
measured in degrees, and geocentric coordinates
1 | #| code-fold: true |
measured in metres.
\index{coordinates!units}
For points on an ellipse, there are two ways in which angle can be
expressed (@fig-ellipse): measured from the centre of the ellipse
($\psi$), or measured perpendicular to the tangent on the ellipse
at the target point ($\phi$).
1 | #| out.width: 60% |
The most commonly used parametric model for the Earth is an
ellipsoid of revolution, an ellipsoid with two equal semi-axes
[@iliffelott]. In effect, this is a flattened sphere (or spheroid):
the distance between the poles is (slightly: about 0.33%) smaller
than the distance between two opposite points on the equator. Under
this model, longitude is always measured along a circle (as in
@fig-sphere), and latitude along an ellipse (as in
@fig-ellipse). If we
think of @fig-ellipse as a cross section of the Earth
passing through the poles, the geodetic latitude measure $\phi$
is the one used when no further specification is given. The latitude
measure $\psi$ is called the geocentric latitude.
\index{latitude!geodetic}
\index{latitude!geocentric}
\index{longitude}
\index{ellipsoid of revolution}
\index{altitude}
\index{altitude!direction}
\index{coordinates!altitude}
we can add altitude or elevation to longitude and latitude to
define points that are above or below the ellipsoid, and obtain
a three-dimensional space again. When defining altitude, we need
to choose:
- where zero altitude is: on the ellipsoid, or relative to the surface approximating mean sea level (the geoid)?
- which direction is positive, and
- which direction is “straight up”: perpendicular to the ellipsoid surface,
or in the direction of gravity, perpendicular to the surface of the geoid?
All these choices may matter, depending on the application area
and required measurement accuracies.
The shape of the Earth is not a perfect ellipsoid. As a consequence,
several ellipsoids with different shape parameters and bound to
the Earth in different ways are being used. Such ellipsoids are called
datums, and are briefly discussed in @sec-crs, along
with coordinate reference systems.