As a public works officer, you manage geographic data on hydrants in Naperville in addition to tables for inspection information and observed violations. In this lesson, you'll relate the Hydrants layer to the inspection tables using a relationship class, so information added to the tables is automatically associated with the hydrants. Then, you'll publish your layer from ArcGIS Pro to ArcGIS Online or ArcGIS Enterprise to share with your workforce.
Download and explore the data
First, you'll download the hydrant inspection data and familiarize yourself with its contents.
- Open ArcGIS Pro.
- If prompted, sign in using your licensed ArcGIS account or an ArcGIS Enterprise named user account.
ArcGIS Pro opens. It contains a list of project templates under the heading Blank Templates. If you've created a project before, it'll include a list of recent projects under the heading Recent Projects.
If you don't have ArcGIS Pro or an ArcGIS account, you can sign up for an ArcGIS free trial.
- Under Blank Templates, click Catalog.
The Catalog template creates a project with no maps associated. This option is best if you're planning to open an existing map.
- In the Create a New Project window, name the project Hydrant Inspections.
By default, the project is saved to the ArcGIS folder, located in the Documents folder on your computer's drive C. To save the project elsewhere, browse to a different location.
- Make sure the Create a new folder for this project box is checked and click OK.
The project opens and displays the Catalog view. In this view, you can manage and browse data.
Now you'll begin adding data for your project. The hydrant data you already have is shared with you in ArcGIS Online. You'll search for and load this data in ArcGIS Pro.
- In the Catalog pane, click Portal and click All Portal. In the search box, type hydrant inspection owner:Learn_ArcGIS and press Enter.
If you've used ArcGIS Pro before, your interface may be arranged differently. If necessary, open the Catalog pane by using the ribbon's View tab. In the Windows group, click Catalog Pane.
If your organization doesn't allow you to search outside of it, you won't get results. You'll need to go to the ArcGIS Online group Manage a Mobile Workforce and download the Hydrant Inspection Data map package by Learn_ArcGIS. In your blank project in ArcGIS Pro, on the Insert tab, in the Project group, click Import Map and browse to the downloaded file.
- Right-click the Hydrant Inspection Data search result and choose Add and Open.
The map package is downloaded and extracted to a geodatabase. A map tab named Layers is added to the project. It has one layer, Hydrants, and two stand-alone tables, Inspections and Violations, that are in the map package. The Hydrants layer is a point layer showing hydrant locations in Naperville, Illinois. The tables are for hydrant inspections and for violations observed during inspections. You'll explore the data in more detail before proceeding.
If you don't see hydrants on the map, right-click the Hydrants layer and choose Zoom to Make Visible.
- In the Contents pane, right-click the Hydrants layer and choose Attribute Table.
The attribute table opens. It contains information about each hydrant, such as its unique facility identification number, its flow rate, and whether it is operable.
- Close the attribute table. In the Contents pane, right-click the Inspections table and choose Open.
The Inspections table only has field names. There is no actual data because there have been no inspections yet. The fields indicate the common elements an inspector checks, such as water pressure and necessary maintenance. There is also a field for the hydrant's unique facility identification number.
- Close the Inspections table and open the Violations table.
Like the Inspections table, the Violations table is empty except for field names.
- Close the Violations table.
Each hydrant may have multiple inspections over time, and each inspection may uncover multiple violations. These relationships can be managed in ArcGIS Pro using relationship classes. A relationship class contains properties that define how objects in one item relate to objects in another item. The map package you opened already contains one relationship class, which you can find in the geodatabase where the data is stored.
- In the Contents pane, right-click the Hydrants layer and choose Properties.
- In the Layer Properties: Hydrants window, click Source to see the path to the geodatabase created for the map package. Select the folder the geodatabase is stored in (not including the name of the geodatabase), press Ctrl+C to copy it, and click OK.
By default, the package is downloaded to Documents\ArcGIS\Packages in a folder starting with HydrantInspectionData. Inside that folder, the v103 folder contains the geodatabase. You'll copy the folder path through v103, for example, C:\Users\YourName\Documents\ArcGIS\Packages\HydrantInspectionData_8C75EB5F-53B1-455E-AB22-D6450E1A88EC\v103.
- On the ribbon, click the Insert tab. In the Project group, click Connections and click Add Database.
- In the Select Existing Geodatabase window, paste (or browse to) the folder where the geodatabase was created for the map package. Select hydrantinspections.gdb and click OK.
- In the Catalog pane, click the Project tab, expand the Databases section, and expand the hydrantinspections geodatabase.
The geodatabase contains four items: the layers and tables you explored earlier, and a relationship class called InspectionToViolations. As the name indicates, it establishes a relationship between the Inspections table and the Violations table. The tables can be managed individually while remaining related. In Collector for ArcGIS, these relationships can be used to display related data automatically.
Create a relationship class
The geodatabase already includes a relationship class between the Inspections and Violations tables. You also want to relate the Hydrants layer to the Inspections table. That way, information about inspections can be accessed by selecting individual hydrants.
- In the Catalog pane, right-click the hydrantinspections geodatabase, point to New, and choose Relationship Class.
The Create Relationship Class geoprocessing tool opens in the Geoprocessing pane. In this pane, you'll set the parameters of the relationship class.
- For the origin table, click the drop-down arrow and choose Hydrants. For the destination table, click Inspections.
- Next to Output Relationship Class, click Browse.
The Output Relationship Class window opens.
- Under Project, click the Databases folder and double-click the hydrantinspections geodatabase. For Name, type HydrantToInspections.
- Click Save.
- For Cardinality, choose One to many (1:M).
Cardinality describes how many objects in the origin class can relate to how many objects in the destination class. Relationships can be one to one, one to many, or many to many. Because each hydrant can have many inspections, the cardinality is one to many.
In the next step, you'll set the attribute field in the origin and destination that the relationship will be based on (called a key field) in order to associate the right hydrant with the right inspection record. You should choose a field that has a unique value for every feature and will have the same value in both the origin and the destination. Generally, an ID field will work. When you looked at the Hydrants and Inspections tables, both tables had a field for the unique facility identification number of the hydrant. You'll use these Facility ID fields as your keys.
- If necessary, for the Origin Primary Key field, choose FACILITYID. For the Origin Foreign Key field, choose FACILITYKEY.
The fields have different names here than in the tables because the tables use aliases to make the field names more readable.
The FACILITYID field contains a unique identification number for each hydrant.
- Click Run.
The new relationship class is added to the geodatabase. The Hydrants layer and Inspections table are now related. By extension, the Hydrants layer is indirectly related to the Violations table, because the Violations table is already related to the Inspections table. Collector supports this kind of relationship nesting up to three levels.
Before you publish the Hydrants layer and its related tables, you'll confirm the relationship on the map.
- On the Map tab, in the Selection group, click Attributes.
The Attributes pane opens.
- In the Attributes pane, click Select one or more features and click the center of any hydrant on the map to view its attributes.
The Attributes pane shows the attribute data of the selected feature.
- Near the top of the Attributes pane, under Hydrants, click the arrow next to the five-digit identifier to expand it.
The relationships of the feature are listed. Currently, the hydrants only show the name of the table to which they are related. If there were any actual inspections for that hydrant, you would be able to see them here.
- Close the Attributes and Geoprocessing panes.
Publish the data
Now that you've created a relationship class, you'll publish the Hydrants layer, as well as the Inspections and Violations tables, to ArcGIS Online or ArcGIS Enterprise. Make sure your related tables are in the table of contents before you publish your layer. That way, both tables will be published along with the Hydrants layer.
- On the Share tab, in the Share As group, click Web Layer.
The Share As Web Layer pane opens. You can use this pane to set the parameters of your web layer before you publish it. You'll want to make sure your web layer is published with feature access instead of tiled mapping in order to preserve the individual hydrant features. You'll also confirm that editing is enabled so your mobile workers can edit the layer.
- For the web layer name, type Hydrants and add your name at the end (use underscores; spaces are prohibited in the name).
The name must be unique within your organization. If you use a name that someone else in the organization has already used, you'll receive an error message.
- Verify that Layer Type is set to Feature.
- Near the top of the Share As Web Layer pane, click Configuration.
- Under Layer(s), next to Feature, click Configure Web Layer Properties.
- Under Operations, check Enable editing and allow editors to and Enable sync. Under Enable editing and allow editors to, verify that Add, update, and delete features is selected.
Checking these boxes allows people to edit the features (including the table data) of your published feature class.
- Click Publish.
Messages along the bottom of the panel report on the publishing. After a minute or two, a message tells you the web layer has been published successfully.
It's recommended that you click Analyze before publishing a web layer. This gives you a chance to view and resolve warnings and errors that may impact the publication process.
- Close the Share As Web Layer pane.
- Save the project and close ArcGIS Pro.
In this lesson, you downloaded your hydrant data and the tables for inspections and violations. You then related those tables to the hydrants using relationship classes. After that, you published the layer and the tables to ArcGIS Online or ArcGIS Enterprise. In the next lesson, you'll use your published layer to create a web map and configure it for data collection.