How to use the arcgis.mapping.WebMap function in arcgis

To help you get started, we’ve selected a few arcgis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Esri / collector-tools / CollectorUtils / scripts / configure_gnss_popup_python_api.py View on Github external
def searchItems_UpdateGNSSMetadataFieldsPopup(args_parser):
    # Search ItemIds
    gis = GIS(args_parser.url, args_parser.username, args_parser.password)
    arcpy.AddMessage("Signed into organization..")
    
    itemId = args_parser.webmap_Name
   
    try:
        arcpy.AddMessage("Started configuring popup and visibility..")
        
        # Iterate through each ItemId and update the popup info for the specified feature layer
        webmapItem = gis.content.search(itemId, item_type="Web Map")  # create a Webmap object from the search result
        webmap = arcgis.mapping.WebMap(webmapItem[0])

        # Configure popup and set visibility on the GNSSMetadata fields.
        fieldInfos = webmap.layers[args_parser.layerIndex]['popupInfo']['fieldInfos'] if args_parser.layerIndex else \
                     webmap.layers[0]['popupInfo']['fieldInfos']
        
        for field_info in fieldInfos:
            # Configure popup and visibility for GNSSMetadata fields
            if field_info['fieldName'].upper() == 'ESRIGNSS_DIRECTION':
                if 'format' in field_info.keys():
                    field_info['format']['places'] = 2
                else:
                    field_info['format'] = {'places' : 2}
                field_info['visible'] = True
                field_info['isEditable'] = False

            if field_info['fieldName'].upper() == 'ESRIGNSS_SPEED':
github joshsharpheward / gis-administration / find_unused_services.py View on Github external
arcpy.AddMessage("Logged into {} as {}".format(arcpy.GetActivePortalURL(), gis.properties['user']['username']))

    # creates list of items of all map image, feature, vector tile and image services (up to 10000 of each) in active portal
    services = (gis.content.search(query="", item_type="Map Service", max_items=10000) +
                gis.content.search(query="", item_type="Feature Service", max_items=10000) +
                gis.content.search(query="", item_type="Vector Tile Service", max_items=10000) +
                gis.content.search(query="", item_type="Image Service", max_items=10000))

    arcpy.AddMessage('Searching webmaps in {}'.format(arcpy.GetActivePortalURL()))

    # creates list of items of all webmaps in active portal
    web_maps = gis.content.search(query="", item_type="Web Map", max_items = 10000)
    # loops through list of webmap items
    for item in web_maps:
        # creates a WebMap object from input webmap item
        web_map = WebMap(item)
        # accesses basemap layer(s) in WebMap object
        basemaps = web_map.basemap['baseMapLayers']
        # accesses layers in WebMap object
        layers = web_map.layers
        # loops through basemap layers
        for bm in basemaps:
            # tests whether the bm layer has a styleUrl(VTS) or url (everything else)
            if 'styleUrl'in bm.keys():
                for service in services:
                    if service.url in bm['styleUrl']:
                        services.remove(service)
            elif 'url' in bm.keys():
                for service in services:
                    if service.url in bm['url']:
                        services.remove(service)
        # loops through layers