本文整理汇总了Python中portalpy.Portal.webmaps方法的典型用法代码示例。如果您正苦于以下问题:Python Portal.webmaps方法的具体用法?Python Portal.webmaps怎么用?Python Portal.webmaps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类portalpy.Portal
的用法示例。
在下文中一共展示了Portal.webmaps方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: count_webmap_url_references
# 需要导入模块: from portalpy import Portal [as 别名]
# 或者: from portalpy.Portal import webmaps [as 别名]
def count_webmap_url_references():
portal = Portal('http://portaldev.esri.com', 'admin', 'esri.agp')
urls = []
for webmap in portal.webmaps():
urls.extend(webmap.urls(normalize=True))
url_counts = dict((url, urls.count(url)) for url in urls)
pprint(url_counts, indent=2)
示例2: count_webmap_item_references
# 需要导入模块: from portalpy import Portal [as 别名]
# 或者: from portalpy.Portal import webmaps [as 别名]
def count_webmap_item_references():
portal = Portal('http://portaldev.esri.com', 'admin', 'esri.agp')
item_ids = []
for webmap in portal.webmaps():
item_ids.extend(webmap.item_ids())
item_id_counts = dict((id, item_ids.count(id)) for id in item_ids)
pprint(item_id_counts, indent=2)
示例3: find_hostname_references
# 需要导入模块: from portalpy import Portal [as 别名]
# 或者: from portalpy.Portal import webmaps [as 别名]
def find_hostname_references():
hostname = 'wh94.fltplan.com'
portal = Portal('http://portaldev.esri.com', 'admin', 'esri.agp')
hostname_references = []
url_items = portal.search(['id','type','url'], portalpy.URL_ITEM_FILTER)
for item in url_items:
if parse_hostname(item['url']) == hostname:
hostname_references.append((item['id'], item['type'], item['url']))
webmaps = portal.webmaps()
for webmap in webmaps:
urls = webmap.urls(normalize=True)
for url in urls:
if parse_hostname(url) == hostname:
hostname_references.append((webmap.id, 'Web Map', url))
pprint(hostname_references, indent=2)
示例4: main
# 需要导入模块: from portalpy import Portal [as 别名]
# 或者: from portalpy.Portal import webmaps [as 别名]
def main(argv=None):
portal = Portal('http://portaldev.esri.com')
template_name = 'Map Notes'
file_gdb_path = 'C:/Temp/MapNotes.gdb'
# Retrieve the layer definitions (schemas) for the specified
# feature collection template
template_id = portal.feature_collection_templates(q=template_name)[0]['id']
template = portal.item_data(template_id, return_json=True)
template_schemas = [layer['layerDefinition'] for layer in template['layers']]
# Create the file GDB with feature classes for each schema
create_file_gdb(file_gdb_path, template_schemas)
# Get all webmaps, pull out features that match the template schemas, and
# then load them into the corresponding feature classes in the file GDB
for webmap in portal.webmaps():
for template_schema in template_schemas:
features = webmap.features([template_schema])
if features:
load_features(file_gdb_path, template_schema['name'], features)
示例5: update_hostname_references
# 需要导入模块: from portalpy import Portal [as 别名]
# 或者: from portalpy.Portal import webmaps [as 别名]
def update_hostname_references():
portal = Portal('http://portaldev.esri.com', 'admin', 'esri.agp')
hostname_map = {'wh94.fltplan.com:8080': 'wh94.fltplan.com'}
url_items = portal.search(['id','type','url'], portalpy.URL_ITEM_FILTER)
for item in url_items:
url = item.get('url')
if url:
url = normalize_url(url)
host = parse_hostname(url, include_port=True)
if host in hostname_map:
url = url.replace(host, hostname_map[host])
portal.update_item(item['id'], {'url': url})
webmaps = portal.webmaps()
for webmap in webmaps:
is_update = False
for url in webmap.urls():
normalized_url = normalize_url(url)
host = parse_hostname(normalized_url, include_port=True)
if host in hostname_map:
new_url = normalized_url.replace(host, hostname_map[host])
webmap.data = webmap.data.replace(url, new_url)
is_update = True
if is_update:
portal.update_webmap(webmap)