Esri Model Builder Upload Publish to Online

As we go on the fight against COVID-19 and enter the wildfire and hurricane season, spider web applications like dashboards assist people make informed, time-sensitive, and even life-saving decisions. Depending on the events your organization is monitoring, things tin can modify apace. Y'all'll need to efficiently publish your web layers, update your information, and overwrite your web layers to continue your dashboards current and relevant.

ModelBuilder in ArcGIS Pro allows you to automate analyzing and updating the data used in your web layers. You may already take a model y'all routinely run to prepare your data for publishing. All that remains is the power to publish web layers or overwrite existing ones in the model. In this article, y'all'll acquire how to create a script tool in ArcGIS Pro 2.8 that publishes or overwrites a web feature layer. The script tool is built on ArcPy functions and geoprocessing tools, allowing you to run it like any other geoprocessing tool in new or existing ModelBuilder models.

Use a custom publishing script tool in ModelBuilder

Y'all'll be guided through each of the four steps below:

  1. Write a Python script. (Not too familiar with Python? Don't worry; a sample script is provided that you tin can modify to run across your specific needs.)
  2. Create a script tool.
  3. Add the script tool to ModelBuilder.
  4. Run the model.

If you want to view the completed script tool and come across how it works in an existing model, download this project to follow along.

Step 1: Write a Python script

The code beneath publishes a new web feature layer or overwrites an existing spider web characteristic layer in ArcGIS Online or ArcGIS Enterprise. Copy and paste the script in a text editor like Notepad and relieve it every bit a Python file (.py). This script can be modified to meet your specific needs. Y'all'll learn how to do this under Adjacent Steps at the end of this article. If y'all would similar to larn more about this publishing script and others similar it, see Introduction to arcpy.sharing.

Stride two: Create a script tool

Side by side, follow all three sections beneath to create a script tool.

Create a custom toolbox to store your tool

1. Open your ArcGIS Pro project. In the Catalog pane, correct-click Toolboxes and click New Toolbox.

Create a new toolbox

ii. On the New Toolbox dialog box, provide a name for your toolbox and click Salve.

Import the Python script

  1. In the Catalog pane, correct-click the new toolbox you just created, and select New > Script.
  2. On the New Script dialog box, under General, provide the following:
    Proper noun: PublishWebFeatureLayer
    Characterization: Publish Web Feature Layer
  1. Browse to the location of the Python script file you lot saved earlier. Select the file and click OK.
  2. Check Import script.
  3. Go out the Tool Properties dialog box open up for the next department.

Script tool properties

Define the parameters of your script tool

Parameters are variables that serve equally inputs for your script tool. When you run the tool, the Python script reads the parameter values before executing the residuum of the script.

Under Parameters, add the following parameters with their backdrop:

Annotation: These properties tin be modified based on your preferences. (For example, yous can change the Share With Organisation parameter then that it defaults to SHARE_ORGANIZATION instead of NO_SHARE_ORGANIZATION.)

0. Label: Map
    Name: in_map
    Information Type: Map
    Blazon: Required
    Direction: Input

1. Label: Web Layer Proper name
    Name: service
    Information Type: String
    Type: Required
    Management: Input

2. Characterization: Summary
    Name: summary
    Information Type: String
    Type: Optional
    Direction: Input

3. Label: Tags
    Proper name: tags
    Data Blazon: String
    Type: Optional
    Direction: Input

4. Characterization: Clarification
    Name: description
    Data Type: String
    Blazon: Optional
    Direction: Input

five. Label: Overwrite Existing Web Layer
    Name: overwrite_existing_service
    Data Type: Boolean
    Blazon: Optional
    Direction: Input

6. Characterization: Enable Editing
    Name: enableEditing
    Information Type: Boolean
    Type: Optional
    Direction: Input
    Category: Configuration

7. Label: Enable Sync
    Proper name: enableSync
    Information Blazon: Boolean
    Blazon: Optional
    Direction: Input
    Category: Configuration

viii. Label: Enable WFS
    Proper name: enableWFS
    Data Type: Boolean
    Blazon: Optional
    Direction: Input
    Category: Configuration

9. Label: Time zone
    Name: timezone
    Information Type: String
    Blazon: Optional
    Direction: Input
    Category: Configuration

ten. Label: Share With Everyone
      Name: share_public
      Information Type: String
      Blazon: Optional
      Direction: Input
      Category: Share with
      Filter: Value List
PUBLIC
PRIVATE
      Default: Private

eleven. Label: Share With Arrangement
      Name: share_organization
      Data Blazon: String
      Type: Optional
      Direction: Input
      Category: Share with
      Filter: Value List
SHARE_ORGANIZATION
NO_SHARE_ORGANIZATION
      Default: NO_SHARE_ORGANIZATION

12. Label: Share With Groups
      Proper name: share_groups
      Data Type: String
      Type: Optional
      Management: Input
      Category: Share with

13. Label: Output Directory
      Proper noun: sddraft_output_directory
      Data Type: Binder
      Blazon: Required
      Direction: Input
      Category: Output

fourteen. Characterization: Rest Endpoint
      Name: Rest_Endpoint
      Data Type: Cord
      Blazon: Derived
      Management: Output

Script tool parameters

Now that you've imported your script and gear up parameters for your tool, click OK on the Tool Properties dialog box.

Learn more near setting script tool parameters

Permit'due south examine the script tool you created. Double-click your script tool to open it.

Publish Web Feature Layer script tool

Publish Web Characteristic Layer is now a custom geoprocessing tool that tin can be run like whatsoever other arrangement geoprocessing tool. It's ready to be added to a model.

Optional: Include metadata

When creating a custom geoprocessing tool, it's recommended to include documentation that helps others use your tool.

Correct-click your script and click Edit Metadata.

Enter tags, summary, and usage. Under Syntax, fill out the fields beneath and click Save.

in_map:

Dialog Caption: Map to publish.

Scripting Caption: Map object of the map to publish.

service:

Dialog Explanation: Enter the name of a new or existing web layer. If the name already exists, the web layer volition be overwritten. Otherwise, a new web layer will be created.

Scripting Explanation: A string that represents the service name.

summary:

Dialog Explanation: Enter a brusque summary of the web layer.

Scripting Explanation: A cord that represents summary.

tags:

Dialog Explanation: Enter keywords or terms that describe the web layer.

Scripting Explanation: A string that represents tags, with different tags separated by comma.

description:

Dialog Caption: Enter an in-depth clarification of the item.

Scripting Explanation: A string that represents a description.

overwrite_existing_service:

Dialog Explanation: If checked and a spider web layer with the same name exists, information technology volition exist overwritten.

Scripting Explanation: A Boolean that determines whether to overwrite an existing web layer.

enableEditing:

Dialog Explanation: Allow users to edit the web layer.

Scripting Explanation: A Boolean that determines whether to enable editing.

enableSync:

Dialog Caption: Disconnected editing with synchronization.

Scripting Explanation: A Boolean that determines whether to enable sync.

enableWFS:

Dialog Explanation: Include a WFS layer.

Scripting Explanation: A Boolean that determines whether to share a WFS layer likewise.

timezone:

Dialog Explanation: Enter the time zone in which your appointment values are stored.

Scripting Caption: A string to set the time zone.

share_public:

Dialog Explanation: Share web layer with the public.

Scripting Explanation: A string that determines if the layer is PUBLIC or Individual.

share_organization:

Dialog Explanation: Share web layer with all authenticated users in your organization.

Scripting Caption: A string that determines whether the layer is shared to the organization.

share_groups:

Dialog Explanation: Share web layer with groups you belong to and its members.

Scripting Explanation: List of existing groups that the layer is to be shared to.

sddraft_output_directory:

Dialog Explanation: The binder on disk where your .sddraft and .sd files volition exist stored.

Scripting Caption: Output directory to create .sddraft and .sd files.

Step 3: Add the script tool to ModelBuilder

To use the tool in ModelBuilder, open an existing model or right-click the toolbox and select New > Model to create a new model. Correct-click the script in your toolbox and click Add together To Model (or drag it into your model).

Model with Publish Web Feature Layer as a custom geoprocessing tool

Yous can include other geoprocessing tools in your model. For instance, y'all can set other processes as preconditions so that they execute before the web layer is overwritten. To learn more than, see Utilise ModelBuilder.

Step 4: Run the model

Double-click the tool and fill out the fields. To overwrite a web layer, provide the name of the existing web layer and cheque the Overwrite Existing Spider web Layer bank check box. If the name already exists, the web layer will be overwritten. Otherwise, a new web layer will be created. Before running it, validate the model to ensure that it will successfully run by clicking ModelBuilder > Run > Validate. One time the model has been validated, click Run to run the entire model. You lot tin can also schedule a model to run repeatedly or at a designated fourth dimension.

Run the model

After the model successfully runs, add together the web layer to a map in ArcGIS Pro or open information technology in Map Viewer.

Next steps

In this article, you learned how to publish and overwrite web feature layers in ModelBuilder past creating and running a script tool in a model. One of the advantages of authoring your ain script tool is that yous can change it to meet your specific needs. A couple of examples are provided below. If you want to learn more about automating sharing workflows in ArcGIS Pro, run into Introduction to arcpy.sharing.

Allow'southward suppose you want to publish your spider web feature layer to a portal folder and let users to export the data. This tin exist washed by adding the portalFolder and allowExporting backdrop in the FeatureSharingDraft.

Right-click the script tool in your toolbox and click Edit. Change the Python file as shown below.

Modify the Python file to include portal and export properties

Modify the Python file to include portal and export properties

Salvage the file. Right-click the script tool and click Backdrop. Add two more than script tool parameters (6 and 11) for the new properties.

Add the new parameters to the script tool

Using what you've learned in the previous sections, you can create a script tool specific to map image layers. The code below publishes or overwrites a map paradigm layer on ArcGIS Enterprise. Follow the same steps discussed previously: save the code as a new Python file (.py), create a script tool, import the .py file, and define script tool parameters. Add the script tool to ModelBuilder and run the model when you have configured it to run across your needs.

The need for readily bachelor information during times of crisis makes your GIS work invaluable. In this article, nosotros've discussed how to create and utilise script tools and ModelBuilder in ArcGIS Pro to efficiently publish and update your spider web layers. Learn more than about how to share your work in ArcGIS Pro.

About the author

Jonah is a product engineer and writer on the ArcGIS Pro Sharing Team with a background in environmental scientific discipline.

Connect:

menesesacurnhooks.blogspot.com

Source: https://www.esri.com/arcgis-blog/products/arcgis-pro/mapping/publish-and-overwrite-web-layers-in-modelbuilder/

0 Response to "Esri Model Builder Upload Publish to Online"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel