基於python的arcgis底圖添加(轉)


本文翻譯自:Qingkai‘s Blog

當使用python的Basemap庫繪制地圖時,選擇一個漂亮的底圖會為圖片增色不少,但是使用map.bluemarble()、map.etopo()或者map.shadedrelief()等函數時,由於分辨率的原因,將圖片縮小到較小范圍會使得底圖非常模糊。其實,創建一個高分辨率的底圖的方式時使用arcgisimage方法。您可以在這里看到Basemap的詳細說明。我將在下邊的例子當中展示幾個非常漂亮的例子。

為了使用arcgisimage方法,你需要為不同的區域指定不同的epsg,並從以下列表中選擇相應的服務(不同的服務請參考這里這里):

  1. World_Physical_Map
  2. World_Shaded_Relief
  3. World_Topo_Map
  4. NatGeo_World_Map
  5. ESRI_Imagery_World_2D
  6. World_Street_Map
  7. World_Imagery
  8. ESRI_StreetMap_World_2D
  9. Ocean_Basemap

你會喜歡哪個底圖呢?你可以在Qingkai’s Github下載腳本文件

In [1]:

 1 from mpl_toolkits.basemap import Basemap
 2 import matplotlib.pyplot as plt
 3 
 4 # let's first define a helper function to plot the map of Bay Area in US. 
 5 
 6 def plot_map(service = 'World_Physical_Map', epsg = 4269, xpixels = 5000):
 7     # note, you need change the epsg for different region, 
 8     #US is 4269, and you can google the region you want
 9     plt.figure(figsize = (8, 8))
10     m = Basemap(projection='mill',llcrnrlon=-123. ,llcrnrlat=37,
11         urcrnrlon=-121 ,urcrnrlat=39, resolution = 'l', epsg = epsg)
12     
13     # xpixels controls the pixels in x direction, and if you leave ypixels
14     # None, it will choose ypixels based on the aspect ratio
15     m.arcgisimage(service=service, xpixels = xpixels, verbose= False)
16     
17     plt.show()

1 - World_Physical_Map

In [2]:

plot_map(service = 'World_Physical_Map', epsg = 4269)

2 - World_Shaded_Relief

In [3]:

plot_map(service='World_Shaded_Relief')

3 - World_Topo_Map

In [4]:

plot_map(service='World_Topo_Map')

4 - NatGeo_World_Map

In [5]:

plot_map(service='NatGeo_World_Map')

 

5 - ESRI_Imagery_World_2D

In [6]:

plot_map(service='ESRI_Imagery_World_2D')

6 - World_Street_Map

In [7]:

plot_map(service='World_Street_Map')

7 - World_Imagery

In [8]:

plot_map(service='World_Imagery')

8 - ESRI_StreetMap_World_2D

In [9]:

plot_map(service='ESRI_StreetMap_World_2D')


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM