球形或椭球形麦卡托
麦卡托投影对于球形和椭球形地球模型产生出不同结果. Wolfram 语言让你对两种情况都能够进行操作.
在大多数网页服务中使用的地球的球形投影,通常被称为“网页麦卡托”.
In[1]:=
![Click for copyable input](assets.zh/spherical-or-ellipsoidal-mercator/In_74.png)
webMercator = {"Mercator",
"ReferenceModel" -> GeodesyData["WGS84", "SemimajorAxis"]}
Out[1]=
![](assets.zh/spherical-or-ellipsoidal-mercator/O_61.png)
In[2]:=
![Click for copyable input](assets.zh/spherical-or-ellipsoidal-mercator/In_75.png)
ellipMercator = {"Mercator", "ReferenceModel" -> "WGS84"}
Out[2]=
![](assets.zh/spherical-or-ellipsoidal-mercator/O_62.png)
用两种投影对牛津大学的位置进行变换.
In[3]:=
![Click for copyable input](assets.zh/spherical-or-ellipsoidal-mercator/In_76.png)
p = GeoPosition[
Entity["University", "UniversityOfOxfordUnitedKingdom36022"]]
Out[3]=
![](assets.zh/spherical-or-ellipsoidal-mercator/O_63.png)
In[4]:=
![Click for copyable input](assets.zh/spherical-or-ellipsoidal-mercator/In_77.png)
GeoGridPosition[p, webMercator][[1]]
Out[4]=
![](assets.zh/spherical-or-ellipsoidal-mercator/O_64.png)
In[5]:=
![Click for copyable input](assets.zh/spherical-or-ellipsoidal-mercator/In_78.png)
GeoGridPosition[p, ellipMercator][[1]]
Out[5]=
![](assets.zh/spherical-or-ellipsoidal-mercator/O_65.png)
北向坐标有一个相应的 33 公里多的差别.
In[6]:=
![Click for copyable input](assets.zh/spherical-or-ellipsoidal-mercator/In_79.png)
GeoGridPosition[p, webMercator][[1]];
GeoGridPosition[p, ellipMercator][[1]];
%% - %
Out[6]=
![](assets.zh/spherical-or-ellipsoidal-mercator/O_66.png)
用两种方法,分别绘制英国和爱尔兰的地图,其结果看上去几乎一致.
In[7]:=
![Click for copyable input](assets.zh/spherical-or-ellipsoidal-mercator/In_80.png)
webmap = GeoGraphics[{FaceForm[], EdgeForm[Red],
Polygon[{Entity["Country", "UnitedKingdom"],
Entity["Country", "Ireland"]}], Red, Point[p]},
GeoProjection -> webMercator, GeoBackground -> None][[1]]
Out[7]=
![](assets.zh/spherical-or-ellipsoidal-mercator/O_67.png)
In[8]:=
![Click for copyable input](assets.zh/spherical-or-ellipsoidal-mercator/In_81.png)
ellipmap =
GeoGraphics[{FaceForm[], EdgeForm[Blue],
Polygon[{Entity["Country", "UnitedKingdom"],
Entity["Country", "Ireland"]}], Blue, Point[p]},
GeoProjection -> ellipMercator, GeoBackground -> None][[1]]
Out[8]=
![](assets.zh/spherical-or-ellipsoidal-mercator/O_68.png)
但是,当我们将同样的地图重叠在一起,就可以清楚地看出区别.
In[9]:=
![Click for copyable input](assets.zh/spherical-or-ellipsoidal-mercator/In_82.png)
Show[webmap, ellipmap]
Out[9]=
![](assets.zh/spherical-or-ellipsoidal-mercator/O_69.png)