<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Return GeoTIFF or KML to Web Tool in ArcGIS Notebooks Questions</title>
    <link>https://community.esri.com/t5/arcgis-notebooks-questions/return-geotiff-or-kml-to-web-tool/m-p/1569016#M878</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am new to ArcGIS python coding and Notebooks, and am trying to develop a custom web tool for our experience builder app. I've successfully created a Notebook (using Notebooks through our ArcGIS Online portal) with input and output parameters, but I'm having trouble with correctly passing my output back to the client/app. The notebook simply takes a single point as input and uses the coordinates to call an external API. The API returns public URLs for a number of different data formats (options are KMZ, GeoTIFF, and SHP), and I'm a bit lost on the best way to use one of these URLs to display the results in the client's map (e.g. in experience builder or even just a web map). I keep running into a "Failed to presist output value files for webtool job with id b4eaaa0aa27b4ce29bb30ff19f305bc9 to job output directory" error. More details below.&lt;/P&gt;&lt;P&gt;Would anyone be willing to give some direction on the best way to accomplish this?&lt;/P&gt;&lt;P&gt;My output parameter:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KurtSmithBGA_0-1734376171413.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/121854iAC48C15CE3FB4625/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KurtSmithBGA_0-1734376171413.png" alt="KurtSmithBGA_0-1734376171413.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's an example of what I'm trying:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KurtSmithBGA_2-1734376485363.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/121856iE2A45EBFC5A2DDDA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KurtSmithBGA_2-1734376485363.png" alt="KurtSmithBGA_2-1734376485363.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;All cells seem to execute successfully, but I get this error in the result:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KurtSmithBGA_3-1734376796106.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/121857i704025CD7FE18F12/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KurtSmithBGA_3-1734376796106.png" alt="KurtSmithBGA_3-1734376796106.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Developer tool view:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KurtSmithBGA_4-1734376922678.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/121858iB401D9449F77A65B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KurtSmithBGA_4-1734376922678.png" alt="KurtSmithBGA_4-1734376922678.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any tips on what I'm doing wrong (or a better way to accomplish this) would be greatly appreciated!&lt;/P&gt;&lt;P&gt;-Kurt&lt;/P&gt;</description>
    <pubDate>Mon, 16 Dec 2024 19:25:08 GMT</pubDate>
    <dc:creator>KurtSmithBGA</dc:creator>
    <dc:date>2024-12-16T19:25:08Z</dc:date>
    <item>
      <title>Return GeoTIFF or KML to Web Tool</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/return-geotiff-or-kml-to-web-tool/m-p/1569016#M878</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am new to ArcGIS python coding and Notebooks, and am trying to develop a custom web tool for our experience builder app. I've successfully created a Notebook (using Notebooks through our ArcGIS Online portal) with input and output parameters, but I'm having trouble with correctly passing my output back to the client/app. The notebook simply takes a single point as input and uses the coordinates to call an external API. The API returns public URLs for a number of different data formats (options are KMZ, GeoTIFF, and SHP), and I'm a bit lost on the best way to use one of these URLs to display the results in the client's map (e.g. in experience builder or even just a web map). I keep running into a "Failed to presist output value files for webtool job with id b4eaaa0aa27b4ce29bb30ff19f305bc9 to job output directory" error. More details below.&lt;/P&gt;&lt;P&gt;Would anyone be willing to give some direction on the best way to accomplish this?&lt;/P&gt;&lt;P&gt;My output parameter:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KurtSmithBGA_0-1734376171413.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/121854iAC48C15CE3FB4625/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KurtSmithBGA_0-1734376171413.png" alt="KurtSmithBGA_0-1734376171413.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's an example of what I'm trying:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KurtSmithBGA_2-1734376485363.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/121856iE2A45EBFC5A2DDDA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KurtSmithBGA_2-1734376485363.png" alt="KurtSmithBGA_2-1734376485363.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;All cells seem to execute successfully, but I get this error in the result:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KurtSmithBGA_3-1734376796106.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/121857i704025CD7FE18F12/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KurtSmithBGA_3-1734376796106.png" alt="KurtSmithBGA_3-1734376796106.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Developer tool view:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KurtSmithBGA_4-1734376922678.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/121858iB401D9449F77A65B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KurtSmithBGA_4-1734376922678.png" alt="KurtSmithBGA_4-1734376922678.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any tips on what I'm doing wrong (or a better way to accomplish this) would be greatly appreciated!&lt;/P&gt;&lt;P&gt;-Kurt&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 19:25:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/return-geotiff-or-kml-to-web-tool/m-p/1569016#M878</guid>
      <dc:creator>KurtSmithBGA</dc:creator>
      <dc:date>2024-12-16T19:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: Return GeoTIFF or KML to Web Tool</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/return-geotiff-or-kml-to-web-tool/m-p/1569616#M879</link>
      <description>&lt;P&gt;I've made some progress and can hopefully narrow down my request for assistance. First, I realize now that KML is not raster, so no surprise that the kmz attempt did not work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I currently am able to get a shapefile URL from the external API, then convert that to a featureset and successfully return it to my app.&lt;/P&gt;&lt;P&gt;However, my current road block is figuring out how to (or if I can...) alter the symbology of the result layer. Surely that is possible somehow?&lt;/P&gt;&lt;P&gt;Here is what I'm currently trying, but it doesn't look like I'm successfully returning the feature collection to the app.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;# Convert shapefile to featureSet
if "ENB_JOBID" in os.environ:
    import requests
    import zipfile
    import os
    from arcgis.gis import GIS
    from arcgis.features import FeatureSet, FeatureCollection, GeoAccessor, GeoSeriesAccessor
   
    # Download the ZIP file
    zip_path = "shapefile.zip"
    response = requests.get(shp_url)
    with open(zip_path, "wb") as f:
        f.write(response.content)
    
    # Extract the ZIP file
    output_dir = os.path.join(os.environ["ENB_JOBID"], "zip")
    os.makedirs(output_dir, exist_ok=True)
    with zipfile.ZipFile(zip_path, "r") as zip_ref:
        zip_ref.extractall(output_dir)
    
    # Locate the .shp file
    shapefile_path = None
    for root, dirs, files in os.walk(output_dir):
        for file in files:
            if file.endswith(".shp"):
                shapefile_path = os.path.join(root, file)
                break
    if shapefile_path:
        print("SHP Path: ", shapefile_path)
    else:
        raise FileNotFoundError("Shapefile (.shp) not found in the extracted ZIP.")
    
    # Load the shapefile into a spatially enabled DataFrame
    sdf = GeoAccessor.from_featureclass(shapefile_path)
    
    #convert to featureset
    output_fs = FeatureSet.from_dataframe(sdf)
    if output_fs:
        print("Output featureSet created.")

# Define DrawingInfo (symbology settings)
drawing_props = {
        "renderer": {
          "type": "simple",
          "symbol": {
            "type": "esriSFS",
            "style": "esriSFSSolid",
            "color": [
              252,
              193,
              184,
              255
            ],
            "outline": {
              "type": "esriSLS",
              "style": "esriSLSSolid",
              "color": [
                110,
                110,
                110,
                255
              ],
              "width": 0.0
            }
          }
        },
    "transparency": 50
}

# Create a FeatureCollection with DrawingInfo
output_fc=sdf.spatial.to_feature_collection(drawing_info=drawing_props)
print("FC: ", output_fc)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 00:20:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/return-geotiff-or-kml-to-web-tool/m-p/1569616#M879</guid>
      <dc:creator>KurtSmithBGA</dc:creator>
      <dc:date>2024-12-18T00:20:02Z</dc:date>
    </item>
  </channel>
</rss>

