GEOG 863:
Web Application Development for Geospatial Professionals

2.1 Publishing the web layer

PrintPrint

2.1 Publishing the web layer

Take a few moments to explore the feature classes, tables, and domains in the ismp file geodatabase that you downloaded in ArcGIS Pro.  The HMZ feature class contains 14 habitat management zone polygons covering Nescopeck State Park.  Note that the HMZs are assigned an integer ID and a name.  The feature class also contains empty fields for the stewardship and outreach indices discussed earlier.

The Species table contains the common and scientific names of the invasive plant species that may be found in the state.

The Species_HMZ table is where observations of invasive species within a HMZ can be recorded (via the Common_Name and HMZ_ID fields).  Also in this table are fields for recording the various ratings discussed earlier: the extent of the invasive, its impact rating, its restoration rating, and finally, its cleanup priority score.

The last two tables – Impact and Restoration – are lookup tables that allow for determining the impact rating of a species given the habitat type it’s found in and the restoration effort rating of a species given its extent. 

Lastly, the geodatabase contains several domains, which we’ll use to place limits on what can be entered in the various fields we’ve discussed (and to provide dropdown lists of options). 

  1. Apply the HabitatTypes domain to the Type field in the HMZ feature class (right-click on HMZ, Data Design > Fields, then choose HabitatTypes under Domain for the Type field).  Likewise, apply the StewardshipVals domain to the Stewardship field and the OutreachVals domain to the Outreach field.

  2. Next, similarly open the field design dialog for the Species_HMZ table and apply domains to the fields as follows:
    SpeciesNames to Common_Name
    ExtentVals
    to Extent_Value
    ImpactVals
    to Impact_Value
    RestorationVals
    to Restoration_Value

    Our goal for this app is for the end user to be able to tap on a HMZ polygon, record a 0-2 stewardship rating and a 0-2 outreach rating for that HMZ, then record any number of invasive species observed in that HMZ (including the various other ratings found in the Species_HMZ table).  One requirement imposed by Field Maps is that each layer/table you’d like to edit must contain a GlobalID field.  This is a field, managed by ArcGIS, that stores a globally unique identifier, or GUID (https://www.techtarget.com/searchwindowsserver/definition/GUID-global-unique-identifier#:~:text=A%20GUID%20(globally%20unique%20identifier,accounts%2C%20documents%20and%20other%20items.), for each feature/row.

  3. Right-click on the HMZ feature class in the Catalog pane and select Manage.  This will open the Manage tab of the Feature Class Properties dialog.  Check the Global IDs checkbox and click OK to add a GlobalID field to the feature class.

  4. Since we also want to be able to edit the Species_HMZ table, carry out the same action for that table. We're going to skip this step - I've struck it out because it's very likely to be unnecessary.

    Another important step in preparing our database will be to create a relationship class between the HMZ feature class and the Species_HMZ table.  As part of this step, we’ll be specifying the primary key field for the HMZ feature class.  This will be the GlobalID field we just added to that feature class.  We’ll also need to specify the field in the Species_HMZ table that should be used to maintain the HMZ-Species_HMZ relationship (i.e., to link each Species_HMZ record to the correct HMZ).

  5. Go into the Species_HMZ table’s field design dialog and add a new field with these parameters:
    Name: HMZ_GUID
    Alias: HMZ_GUID
    Data Type: Guid

    Both GlobalID fields and Guid fields store GUID values.  The difference is that GlobalID fields are automatically managed by ArcGIS, whereas Guid fields are not.  The purpose of this field we’re adding here is, as was just mentioned, to act as the linkage between the rows in the Species_HMZ table and the associated features in the HMZ feature class.

  6. Create the relationship class by right-clicking on your geodatabase and selecting New > Relationship Class.  In the Create Relationship Class tool dialog, make the following settings:
    Origin Table: HMZ
    Destination Table: Species_HMZ
    Output Relationship Class: HMZ_Species_HMZ_RC
    Cardinality: One to many
    Origin Primary Key: GlobalID
    Origin Foreign Key: HMZ_GUID


    Leave all other options set to their defaults, then click Run to create the relationship class.

  7. If you haven’t already, add the HMZ feature class to a new map.  Also add the 4 tables: Impact, Restoration, Species, and Species_HMZ.

  8. Change the display of the HMZ layer so that it uses a Unique Values symbology based on the Type field (or the HMZ_ID field, your choice).  (I’m partial to the Cool Tones color scheme myself.)

    We’re now ready to publish the contents of the map to ArcGIS Online (AGO) so that it can be used in a Field Maps app.

  9. Go to Share > Web Layer > Publish Web Layer.  

  10. In the Share As Web Layer tool dialog, make the following settings under the General tab:
    Name: ISMP Web Layer <your username>
    Folder:
    Create a new folder called fieldmaps

    Accept the defaults for all other options on this tab, but do not publish yet. The reason we're calling our layer something like "ISMP Web Layer aaa123" is that all of our layers need to have a unique name in AGO. 

  11. Under the Configuration tab, click the pencil icon next to the Feature layer to access a number of configuration options.  Check the Enable editing checkbox, leaving all of the edit types checked and the Attributes and geometry option selected. 

  12. Click Analyze to run a check of whether the map can be successfully published. 

    You should get 2 warnings of “Layer’s data source is not supported.”  This is in reference to the two background layers that are included in ArcGIS Pro maps by default.  It’s not strictly necessary, but remove these layers from the map.

    The other issue you’ll see noted in the Analyzer results is an error that “Unique numeric IDs are not assigned.”  Let’s take a moment to reflect on what we’re doing here.  We’re hoping to make all the items loaded in the map -- the polygon layer and standalone tables – available for use in AGO.  The singular name of “web layer” may seem confusing since our map could have any number of layers/tables in it, but that is the term for what is being produced in AGO.  Each layer/table found in this Pro map is going to be published to AGO.  One of the requirements before we can publish is that each layer/table needs a unique ID assigned to it.  This can be done through a Map Properties setting, which we can access via a shortcut in the Analyzer results.

  13. In the Analyzer results, hover your mouse over the error, click the button, then select Open Map Properties to Allow Assignment.

  14. Under the General settings, put a check in the Allow assignment of unique numeric IDs… checkbox, then click OK to dismiss the Map Properties dialog.

    You should see the red X in the Analyzer results change to a green checkmark. 

  15. Click Analyze again.  You should now receive no errors or warnings. 

  16. Click Publish.  The Share As Web Layer tool will churn for a minute or two, before you should see a message that the web layer published successfully.

    You should now be able to browse to your AGO account and see a hosted feature layer and service definition both with the name ISMP Web Layer.

    Field Maps operates on web maps, so before we can create an app with Field Maps we’ll first need to create a web map containing our new web/feature layer.

  17. While looking at the items in your fieldmaps AGO folder, click the next to the feature layer and select Open in Map Viewer.

  18. At this point, we could modify the layer’s symbology or how info is displayed in its popups.  However, let's hold off on doing any such configuration for now. Simply click the Save and open button, assign a name of ISMP Web Map, specify that you want to put it in the fieldmaps folder, then click Save.  

  19. Return to your AGO Content page ("hamburger" icon in the upper left > Content), where you should now see the newly created web map.  Click the … next to it and select Open in Field Maps Designer.

Note: I attempted two variations on this workflow, but neither was successful:

  • Using the Share as Web Map tool in Pro instead of Share as Web Layer.  This both creates the new AGO feature layer and a web map containing that layer, cutting out the need to add the new feature layer to the Map Viewer and save a web map as separate steps.  However, feature edits in a web map created in this way didn't work for me as required.  
  • Creating the relationship class as many-to-many rather than 1-to-many.  Each HMZ can have many species and each species can appear in many HMZs.  Creating the relationship class in this way would automatically create an intermediate table that would store the HMZ-species combinations.  However, again, feature edits didn't work as required when I attempted to go this route.

With the necessary data published to AGO and a web map created from it, we're now ready to configure the web map for staff who will be opening it in the Field Maps app on their mobile devices.