Getting to Know Web GIS. Pinde Fu
attribute expressions using Arcade.
4 Under Attribute Expressions, click the Add button.The expression editor window appears. Next, you will build the expression Round($feature .Estimate2016 / $feature.Census2010, 2), which calculates the ratio of population 2016 and 2010 for each city, and rounds the result to two decimals.
5 In the expression editor, do the following:Click the Edit link by the title Custom and change the title to Population Ratio 2016/2010.Click in the Expression text area.Click Functions, search and click Round.In the Expression area, remove fieldOrValue.Click Globals, find and click $feature.Estimate2016, press the / key, and find and click $feature.Census2010.Click numPlaces and change it to 2.Click Test to verify if the results look correct. If not, correct the expression based on the error message.Click OK.
Next, you will build an expression like Round($feature.PopOwnOcc / $feature .Census2010, 2) * 100, to calculate the percentage of population-owned housing in 2010 for each city.
1 Under Attribute Expressions, click the Add button again. In the expression editor, perform the following actions:Change the title to % Population Own Houses.Set the expression to Round($feature.PopOwnOcc / $feature .Census2010, 2) * 100.Click Test to make sure the results look correct.Click OK.
2 In the Display menu under Pop-up Contents, make sure A list of field attributes is selected, and then click the Configure Attributes link.In the Configure Attributes dialog box, make the following choices:Select {Rank} and set its alias as Rank 2016.Select the expression field Population Ratio (2016/2010).Select the expression field % Population Own Houses, and set its format to 0 decimal places.Clear the check boxes for the rest of the fields.
Some of the fields already appear in the title, and some others will be displayed in charts and image links. Thus, you unselect these fields.
Hiding them from the attribute list will make your layer pop-up simple and clear.
Click OK to close the Configure Attributes window.
1 At the bottom of the Configure Pop-up pane, click OK to apply your pop-up configuration.
2 Click any city on the map to review the new pop-up.You will see that the pop-up window is simpler and easier to read than the default pop-up. Also note the pop-up includes the custom expression you built with Arcade.
3 On the map viewer menu bar, click Save to save your changes.2.4 Add images and charts to pop-up windows
Media, such as images and charts, can more effectively engage users and improve their understanding of your data.
The tutorial CSV contains two URL fields, Wikipedia_URL and Picture_URL. You will use the first URL to add a picture to the city layer’s pop-up and the second URL to link the picture with the city’s Wikipedia page so that users can gather supplementary information about the city’s population changes. Charts require numeric attribute fields. The US cities layer contains several of these fields. You will display them in appropriate charts to exemplify the cities’ population trends.
1 In the Contents pane, point to the Top 50 US Cities layer, click the More Options button, and click Configure Pop-up.
2 In Pop-up Media, click Add, and then click Image.In the Configure Image window, make the following changes:Enter About the city as the title (leave the Caption window blank).In the URL box, click the Plus button, and click the Picture_URL field.In the Link (optional) box, click the Plus button and click the Wikipedia_URL field.
3 Click OK to close the Configure Image window.The image title, caption, image URL, and link URL can all take the form of static text, attribute field values, or a combination of the two. If you do not have image and link URL fields when you do the assignment, specify a static URL instead. For example, you can use http://www.census.gov/history/img/Census_Logo.jpg as the image URL, and http://www.census.gov as the Link URL. This way, the pop-up windows for all cities display the same image and link to the same web page. You can add additional images to your pop-up window simply by repeating steps 2 and 3.
4 In the Configure Pop-up pane, click the OK button to apply your pop-up configuration.
5 Click a city on the map to observe the new pop-up.The pop-up window displays the city’s seal or flag. If you click on the image, the city’s Wikipedia page will appear.
6 In the Contents pane, point to the Top 50 US Cities layer, click the More Options button, and click Configure Pop-up again. In the Pop-up Media section, click Add, and then click Line Chart.
7 In the Configure Line Chart window, make the following settings:For Title, specify Population Change (2010 - 2016).For Chart Fields, check the 2010, 2011, 2012, 2013, 2014, 2015, and 2016 population fields.
8 Click OK to close the Configure Line Chart window
9 Click OK to apply your configuration.
10 Click a city, for example, Detroit, Michigan, to see the new pop-up (use the Search box to find Detroit and other cities if necessary). In the pop-up, to the right of the city seal or flag image, click the right arrow to see the chart you configured.You will notice that the population of Detroit has been decreasing.
11 In the Contents pane, point to the Top 50 US Cities layer, click the More Options button , and click Save Layer.This step saves the pop-up configuration to the layer item itself. When you add this layer to any web maps, the layer will carry the pop-up you defined in this section as the default.
12 Save your web map.
The new pop-up you configured does more than display raw attribute values. The pop-up leverages the URLs stored in the attributes to display and link a picture to a website that provides additional details. The pop-up also charts the numeric fields to provide a visual interpretation of population changes.
2.5 Use layers from the ArcGIS Living Atlas of the World
You don’t always have to create your own layers. You can use layers from the Living Atlas as your operational layers. In this section, you will use a layer from the Living Atlas to further display the US population change patterns.
1 On the map viewer menu bar, click the Add button , and from the list, click Browse Living Atlas Layers.In the Living Atlas pane, you will explore the extensive categories and subcategories of layers available.
2 In the Living Atlas pane, click the Filter button to see the list of categories.
3 In the Filter pane, browse the Categories, Regions, and Item Type groups. Notice the options available, and click the X button to close the Filter pane.
4 In the search box, type population growth, and press Enter.
5 In the result list, click the 2017-2022 USA Population Growth layer to see the Item Details pop-up. Click Add to map, and then close the Item Details pop-up.If you added the wrong layer, you can remove that layer by clicking the Remove button.
6 In the Contents pane, point to the 2017-2022 USA Population Growth Rate layer you just added, click the More Options button , and click Show Item Details.This action will bring up the item details about the layer. This map layer shows the estimated annual growth rate of the population in the US from 2017 to 2022 in a multiscale map by state, county, ZIP Code, tract, and block group.
7 Go back to the map viewer by clicking the corresponding browser tab. Zoom in and out of the map to examine the population change patterns. Click a state, county, zip, tract, or block group to see the information in the pre-configured pop-ups.You should see that the population change trends of the 50 major cities generally agree with the trends of their counties, zips, tracts, and block groups. Note: You may see multiple features at the location you clicked. In such cases, the pop-up will show one feature at a time. You can click the arrow in the pop-up header to navigate through