<?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 Portal hosted geoprocessing service won't put out in Publishing and Managing Services Questions</title>
    <link>https://community.esri.com/t5/publishing-and-managing-services-questions/portal-hosted-geoprocessing-service-won-t-put-out/m-p/1461470#M1209</link>
    <description>&lt;P&gt;I created a script tool in ArcGIS Pro that prompts user to input a .csv file as an address table and then designate an output csv path.&lt;/P&gt;&lt;P&gt;The tool uses a geocoding service hosted on our enterprise portal and uses an ArcGIS Server based token to access the geocoding service.&lt;/P&gt;&lt;P&gt;I ran the tool and it works fine in ArcGIS Pro. I then ran it in jupyter notebooks outside of ArcGIS Pro pointing to a cloned python environment. This also worked fine.&lt;/P&gt;&lt;P&gt;I then published the tool to our enterprise portal hoping to use it as a geoprocessing tool in Web App Builder. I've checked the box to allow exports as part of the process but when I run the tool in WAB I get a token error. There is no option in WAB geoprocessing widget to designate output location.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway I can do this so the geocoding outputs are written to a user specified path? I'm hoping that nothing higher than a viewer license is needed for this as the output is not being stored on portal, the geocoding service is hosted on our portal using our own internal reference data, and token is being used to access the portal histed geocoding service and geocoding geoprocessing service.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;"""This a tool in python that can be published from ArcGIS Pro to enterprise ArcGIS Portal. The tool should be able to geocode &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;a .csv file listing addresses."""&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;import arcpy&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;from arcgis.gis import GIS&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;from arcgis.geocoding import geocode, get_geocoders&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;import pandas as pd&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;# Get the input parameters&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;csv_path = arcpy.GetParameterAsText(0)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;single_line_address = arcpy.GetParameterAsText(1) # This should be a boolean parameter&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;output_csv = arcpy.GetParameterAsText(2)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;# Format output title with .csv extension and file directory&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;output_csv = output_csv + ".csv"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;# Connect to the GIS&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;gis = GIS("&lt;A href="https://myportal.org/arcgis" target="_blank"&gt;https://myportal.org/arcgis&lt;/A&gt;", api_key='Mytokenplaceholder')&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;# Get the first geocoder&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;geocoders = get_geocoders(gis)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;# Distill the composite locator that uses SPAD, parcels and street files for reference data&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;for geocoder in geocoders:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;if "SPAD" in str(geocoder):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;SPAD_Comp_locator = geocoder&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;arcpy.AddMessage(f"SPAD locator found: {SPAD_Comp_locator}")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;break&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;# Read the CSV file&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;df = pd.read_csv(csv_path)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;# Create an empty DataFrame to store the results&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;results_df = pd.DataFrame(columns=['address', 'location', 'score'])&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;# Loop through the rows of the DataFrame&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;for index, row in df.iterrows():&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;# If the address is in a single field, use that field as the address&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;if single_line_address:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;address = row['Address']&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;# Otherwise, concatenate the city, state, and zip fields&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;else:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;address = f"{row['Address']}, {row['City']}, {row['State']}, {row['Zip']}"&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;# Geocode the address&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;geocode_result = geocode(address, geocoder=SPAD_Comp_locator)&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;# Print the result&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;print(geocode_result[0]['address'], geocode_result[0]['location'], geocode_result[0]['score'])&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;# If the geocode result is not empty, add it to the results DataFrame&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;if geocode_result:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;result = geocode_result[0]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;results_df.loc[index] = [result['address'], result['location'], result['score']]&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;# Write the results DataFrame to a new CSV file in the output directory&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;results_df.to_csv(output_csv, index=False)&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description>
    <pubDate>Mon, 13 May 2024 22:43:15 GMT</pubDate>
    <dc:creator>AlcoGISUser</dc:creator>
    <dc:date>2024-05-13T22:43:15Z</dc:date>
    <item>
      <title>Portal hosted geoprocessing service won't put out</title>
      <link>https://community.esri.com/t5/publishing-and-managing-services-questions/portal-hosted-geoprocessing-service-won-t-put-out/m-p/1461470#M1209</link>
      <description>&lt;P&gt;I created a script tool in ArcGIS Pro that prompts user to input a .csv file as an address table and then designate an output csv path.&lt;/P&gt;&lt;P&gt;The tool uses a geocoding service hosted on our enterprise portal and uses an ArcGIS Server based token to access the geocoding service.&lt;/P&gt;&lt;P&gt;I ran the tool and it works fine in ArcGIS Pro. I then ran it in jupyter notebooks outside of ArcGIS Pro pointing to a cloned python environment. This also worked fine.&lt;/P&gt;&lt;P&gt;I then published the tool to our enterprise portal hoping to use it as a geoprocessing tool in Web App Builder. I've checked the box to allow exports as part of the process but when I run the tool in WAB I get a token error. There is no option in WAB geoprocessing widget to designate output location.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway I can do this so the geocoding outputs are written to a user specified path? I'm hoping that nothing higher than a viewer license is needed for this as the output is not being stored on portal, the geocoding service is hosted on our portal using our own internal reference data, and token is being used to access the portal histed geocoding service and geocoding geoprocessing service.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;"""This a tool in python that can be published from ArcGIS Pro to enterprise ArcGIS Portal. The tool should be able to geocode &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;a .csv file listing addresses."""&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;import arcpy&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;from arcgis.gis import GIS&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;from arcgis.geocoding import geocode, get_geocoders&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;import pandas as pd&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;# Get the input parameters&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;csv_path = arcpy.GetParameterAsText(0)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;single_line_address = arcpy.GetParameterAsText(1) # This should be a boolean parameter&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;output_csv = arcpy.GetParameterAsText(2)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;# Format output title with .csv extension and file directory&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;output_csv = output_csv + ".csv"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;# Connect to the GIS&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;gis = GIS("&lt;A href="https://myportal.org/arcgis" target="_blank"&gt;https://myportal.org/arcgis&lt;/A&gt;", api_key='Mytokenplaceholder')&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;# Get the first geocoder&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;geocoders = get_geocoders(gis)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;# Distill the composite locator that uses SPAD, parcels and street files for reference data&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;for geocoder in geocoders:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;if "SPAD" in str(geocoder):&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;SPAD_Comp_locator = geocoder&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;arcpy.AddMessage(f"SPAD locator found: {SPAD_Comp_locator}")&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;break&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;# Read the CSV file&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;df = pd.read_csv(csv_path)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;# Create an empty DataFrame to store the results&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;results_df = pd.DataFrame(columns=['address', 'location', 'score'])&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;# Loop through the rows of the DataFrame&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;for index, row in df.iterrows():&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;# If the address is in a single field, use that field as the address&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;if single_line_address:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;address = row['Address']&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;# Otherwise, concatenate the city, state, and zip fields&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;else:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;address = f"{row['Address']}, {row['City']}, {row['State']}, {row['Zip']}"&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;# Geocode the address&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;geocode_result = geocode(address, geocoder=SPAD_Comp_locator)&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;# Print the result&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;print(geocode_result[0]['address'], geocode_result[0]['location'], geocode_result[0]['score'])&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;# If the geocode result is not empty, add it to the results DataFrame&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;if geocode_result:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;result = geocode_result[0]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;results_df.loc[index] = [result['address'], result['location'], result['score']]&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;# Write the results DataFrame to a new CSV file in the output directory&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699"&gt;results_df.to_csv(output_csv, index=False)&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Mon, 13 May 2024 22:43:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/publishing-and-managing-services-questions/portal-hosted-geoprocessing-service-won-t-put-out/m-p/1461470#M1209</guid>
      <dc:creator>AlcoGISUser</dc:creator>
      <dc:date>2024-05-13T22:43:15Z</dc:date>
    </item>
  </channel>
</rss>

