print("    Set Enterprise background")

    # set banner
    dept_gis.admin.ux.set_banner("style_files/banner.png")
    print("    Set Enterprise banner")

    # set name
    dept_gis.admin.ux.set_name_description("Pasadena City Fire Dept. GIS",
                                     "Official WebGIS of Fire Department of the city of Pasadena")
    print("    Set Enterprise name")

    # set extent
    ext = {"type": "extent", "xmin": -13159633.604126614, "ymin": 4044388.6476039286, "xmax": -13145941.30675904,
           "ymax": 4053939.28118214, "spatialReference": {"wkid": 102100}
           }
    dept_gis.update_properties({'defaultExtent': ext})
    print("    Set Enterprise extent")

    # set featured groups
    search_result = dept_gis.groups.search("Damage Assessment")
    featured_group = None
    if len(search_result) > 0:
        featured_group = search_result[0]

        param_dict = {"homePageFeaturedContent": "id:{}".format(featured_group.groupid),
                      "homePageFeaturedContentCount": 12}

        dept_gis.update_properties(param_dict)
        print("    Set home page featured content")

    print("============================================================")
    print("    Set Enterprise background")

    # set banner
    dept_gis.admin.ux.set_banner("style_files/banner.png")
    print("    Set Enterprise banner")

    # set name
    dept_gis.admin.ux.set_name_description("Pasadena City Fire Dept. GIS",
                                     "Official WebGIS of Fire Department of the city of Pasadena")
    print("    Set Enterprise name")

    # set extent
    ext = {"type": "extent", "xmin": -13159633.604126614, "ymin": 4044388.6476039286, "xmax": -13145941.30675904,
           "ymax": 4053939.28118214, "spatialReference": {"wkid": 102100}
           }
    dept_gis.update_properties({'defaultExtent': ext})
    print("    Set Enterprise extent")

    # set featured groups
    search_result = dept_gis.groups.search("central_services")
    featured_group = None
    if len(search_result) > 0:
        featured_group = search_result[0]

        param_dict = {"homePageFeaturedContent": "id:{}".format(featured_group.groupid),
                      "homePageFeaturedContentCount": 12}

        dept_gis.update_properties(param_dict)
        print("    Set home page featured content")

    print("============================================================")
Exemple #3
0
gis

# This is the default Esri Geocode Service:
upd = {'geocodeService': [{
    "url": "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer",
    "northLat": "Ymax",
    "southLat": "Ymin",
    "eastLon": "Xmax",
    "westLon": "Xmin",
    "name": "Esri World Geocoder",
    "batch": "false",
    "placefinding": "true",
    "suggest": "true"},
]}

gis.update_properties(upd)


# Usage Example: Update the geocode service and call it 'AtlantaLocator'
upd = {'geocodeService': [{
  "singleLineFieldName": "Single Line Input",
  "name": "AtlantaLocator",
  "url": "https://some.server.com/server/rest/services/GeoAnalytics/AtlantaLocator/GeocodeServer",
  "itemId": "abc6e1fc691542938917893c8944606d",
  "placeholder": "",
  "placefinding": "true",
  "batch": "true",
  "zoomScale": 10000},
]}

gis.update_properties(upd)
    print("    Downloaded the config archive")

    #extract the zip file
    zf = ZipFile(config_file)
    zf.extractall(download_path)
    config_str_path = [afile for afile in zf.filelist if afile.filename.endswith('/config.json')][0]
    config_str = zf.read(config_str_path)
    config_dict = json.loads(config_str)
    print("    Reading configurations")

    #Set logo
    # print(download_path + "/" + city_name + '/logo.png')
    city_gis.ux.set_logo(download_path + "/" + city_name + '/logo.png')
    print("    Set Enterprise logo")

    #set background
    city_gis.ux.set_background(download_path +"/" + city_name + "/background.png")
    print("    Set Enterprise background")

    # set banner
    city_gis.ux.set_banner(download_path + "/" + city_name + "/banner.png")
    print("    Set Enterprise banner")

    # set name
    city_gis.ux.set_name_description(city_name.replace("_", " ").title() + " city GIS",
                                     "Distributed GIS between county and city govt.")
    print("    Set Enterprise name")

    # set extent
    city_gis.update_properties({'defaultExtent':config_dict['extent']})
    print("    Set Enterprise extent")
    config_str_path = [
        afile for afile in zf.filelist
        if afile.filename.endswith('/config.json')
    ][0]
    config_str = zf.read(config_str_path)
    config_dict = json.loads(config_str)
    print("    Reading configurations")

    #Set logo
    # print(download_path + "/" + city_name + '/logo.png')
    city_gis.ux.set_logo(download_path + "/" + city_name + '/logo.png')
    print("    Set Enterprise logo")

    #set background
    city_gis.ux.set_background(download_path + "/" + city_name +
                               "/background.png")
    print("    Set Enterprise background")

    # set banner
    city_gis.ux.set_banner(download_path + "/" + city_name + "/banner.png")
    print("    Set Enterprise banner")

    # set name
    city_gis.ux.set_name_description(
        city_name.replace("_", " ").title() + " city GIS",
        "Distributed GIS between county and city govt.")
    print("    Set Enterprise name")

    # set extent
    city_gis.update_properties({'defaultExtent': config_dict['extent']})
    print("    Set Enterprise extent")