當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


Python ArcGIS WebMap.basemap用法及代碼示例


本文簡要介紹 python 語言中 arcgis.mapping.WebMap.basemap 的用法。

用法:

property basemap

返回:

作為字典的底圖圖層列表

獲取/設置 WebMap 中的基本Map圖層。

Parameter

Description

value

必需的字符串。您想要將什麽底圖應用於Map(‘topo’、‘national-geographic’等)。有關完整列表,請參閱basemapsgallery_basemaps

例子:

# Usage example 1: Get the basemap used in the web map

from arcgis.mapping import WebMap
wm = WebMap(wm_item)

wm.basemap
>> {"baseMapLayers": [
    {"id": "defaultBasemap",
    "layerType": "ArcGISTiledMapServiceLayer",
    "url": "https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer",
    "visibility": true,
    "opacity": 1,
    "title": "Topographic"
    }],
    "title": "Topographic"
    }

# Usage example 2: Set the basemap used in the web map
from arcgis.mapping import WebMap
wm = WebMap(wm_item)

print(wm.basemaps)
>> ['dark-gray-vector', 'gray-vector', 'hybrid', 'oceans', 'osm', 'satellite', 'streets-navigation-vector', 'streets-night-vector', 'streets-relief-vector', 'streets-vector', 'terrain', 'topo-vector']
wm.basemap = 'dark-gray'
print(wm.gallery_basemaps)
>> ['custom_dark_gray_canvas', 'imagery', 'imagery_hybrid', 'light_gray_canvas', 'custom_basemap_vector_(proxy)', 'world_imagery_(proxy)', 'world_street_map_(proxy)']
wm.basemap = 'custom_dark_gray_canvas'

# Usage example 3: Set the basemap equal to an item
from arcgis.mapping import WebMap
wm = WebMap(wm_item)
# Use basemap from another item as your own
wm.basemap = wm_item_2
wm.basemap = tiled_map_service_item
wm.basemap = image_layer_item
wm.basemap = wm2.basemap
wm.basemap = wm2

相關用法


注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 arcgis.mapping.WebMap.basemap。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。