In the previous lesson, you joined your homeless data to a layer of the United States. You can use this layer to map homelessness variables in North Dakota and the rest of the country. To share your results as widely as possible, you'll publish your layer to ArcGIS Online.
Clean up the joined table
Before you publish data, it should be as clear and concise as possible. When you opened the United States layer’s attribute table, you saw there was much more data than necessary. As with the original Excel file, you'll clean up the table to show only the data you intend to use.
- If necessary, open your Homeless Map in ArcMap.
- In the Table of Contents, right-click USA_States_Generalized and choose Properties.
- In the Layer Properties window, click the Fields tab.
The Fields tab shows all fields for the layer. If a field is checked, it's visible in the attribute table.
- In the row of tools above the field names, click the Turn all fields off button.
- Check the boxes next to the following fields:
- Click OK.
- Open the USA_States_Generalized attribute table to confirm that only the fields you checked remain visible.
The other fields have been turned off but not removed entirely. You can turn them back on the same way you turned them off.
- Close the attribute table.
Export the layer to a new feature class
The current layer can't be published for two reasons. First, it’s already a published feature service on ArcGIS Online; you originally added it from there, after all. Second, you can't publish a layer if all or part of its table is from a data source unsupported by ArcGIS Online (such as Microsoft Excel or a similar spreadsheet program). You can bypass both problems by exporting the layer as a new shapefile, which will preserve the data but change the source to a publishable file type.
- In the Table of Contents, right-click USA_States_Generalized, point to Data, and choose Export Data.
- In the Export Data window, for Output feature class, click the Browse button and browse to the Homeless Project folder.
- In the Saving Data window, for Name, type USA_States. For Save as type, choose Shapefile.
Upon choosing Shapefile, .shp (the file extension for shapefiles) is automatically added to the end of the file name.
- Click Save to return to the Export Data window.
The Output feature class setting should look similar to the following image:
Alternatively, you can edit the Output feature class text box directly to contain both the navigation path to the Homeless Project folder and the output file name as formatted above.
- Click OK. When prompted to add the exported data to the map as a layer, click Yes.
The symbology of the new layer has changed, but otherwise it looks the same.
- In the Table Of Contents, right-click USA States (Generalized) and choose Remove to remove the original group layer from the map.
- Open the Layer Properties window for the new USA_States layer and click the Fields tab.
Another benefit of exporting data is that fields that are not checked are not copied to the new dataset. The only fields now are the four fields you checked and the FID and Shape fields, which are mandatory fields for shapefiles and managed by the software.
The field names are inconsistently formatted and not very descriptive. Shapefile field names must be no more than 10 characters and have no spaces or symbols other than underscores. Field aliases, which act as display names for fields, have no such restrictions.
- Click the STATE_NAME field. In the right pane of the Fields tab, change the alias to State.
- Change the aliases of the following fields. When you’re finished, click OK.
- Change: Homeless Change (2012-13)
- Pop13: Population (2013)
- Homeless13: Homeless Count (2013)
- Open the attribute table to confirm your changes.
- Close the attribute table and save the map.
Publish the layer to ArcGIS Online
You'll now publish the layer as a hosted feature layer to ArcGIS Online. To transform a disk-based layer to a web-based layer, you must have a Publisher role in an ArcGIS Online organization.
- On the main menu, click File and choose Sign In.
- Sign in to your ArcGIS organizational account.
If you don't have an organizational account, you can sign up for an ArcGIS free trial.
- On the main menu, click File, point to Share As, and choose Service.
- In the Share as Service window, confirm that the option to Publish a service is selected and click Next.
- Ensure that Choose a connection is set to your organization. Change the service name to Homelessness and add your name to the end (use underscores, as spaces are prohibited in the name).
The service name must be unique within the organization. If you use a name that someone else in the organization has already used, you’ll receive an error message.
- Click Continue.
The Service Editor window opens. The Service Editor is where you specify the properties of the layer you are publishing.
- In the left pane of the Service Editor window, click Capabilities.
The Capabilities pane has two options: Tiled Mapping and Feature Access. Tile layers are collections of spatially-adjacent images, or tiles, and are usually used as basemaps. Feature layers are composed of discrete elements that can be edited and symbolized. Publishing this layer as a feature layer will allow you to symbolize the states according to their attributes.
- If necessary, uncheck the Tiled Mapping box and check the Feature Access box.
- In the left pane, click Item Description.
For a layer to be published as a service, it must have metadata (data about data). Only a summary and search tags are necessary, but adding more metadata will clarify to users what your layer contains and from where you retrieved the data.
- Fill in the following fields:
- Summary: Homeless data in the United States
- Tags: homelessness, United States, 2013
- Description: A feature layer of the United States with data by state on the 2013 homeless population and the change in homeless population between 2012 and 2013.
- Access and Use Constraints: None
Credits: United States Department of Housing and Urban Development
- In the left pane, click Sharing. Check the box next to your organization to make your layer viewable by everyone in the organization. Optionally, you can check the box next to Everyone (public) to make it viewable by all users of ArcGIS Online.
If you check Everyone, your organization is automatically checked.
Before publishing, you'll analyze the service to ensure there are no outstanding problems.
- At the upper right of the Service Editor window, click Analyze.
The Prepare window opens, showing any errors, warnings, and messages. The service editor will not publish your layer if there are any errors (marked by a red X), but warnings and messages will not prevent publication. In this case, there should not be any errors.
ArcGIS Help has additional details on the types of messages you may receive.
- Close the Prepare window.
- At the upper right of the Service Editor window, click Publish.
After a few moments, a message indicates that the service has been published successfully.
- Click OK in the Service Publishing Result window.
- Save your map and close ArcMap.
In this lesson, you prepared your layer for the web and published it. In the next lesson, you'll use your published layer to create three maps about homelessness in the United States to show how North Dakota’s homeless problem compares to the rest of the country.