许多人在ArcGIS Desktop中使用过表达式、图层过滤、标注等。现在有一种新的跨平台的表达式,叫做Arcade表达式,可以在桌面的ArcGIS Pro、门户、网页端开发、移动端开发共同去使用的一种语言。主要用途有:可视化数据、标注要素、创建弹出窗口的内容。
特点:
即拿即用 -- 通过ArcGIS 写、分享、执行 表达式
轻量化 -- 以最小的影响运行在ArcGIS上
安全 -- 没有可执行代码,该代码不能在ArcGIS以外运行,在ArcGIS程序上下文内使用时才会执行。
表达式语言 -- 编写ArcGIS可以执行的语句
为了ArcGIS使用 -- Esri开发的Arcade为了在ArcGIS中使用
总则:评估和理解表达式的上下文。一些总则提供多个全局变量,其他总则提供只有一个或不提供。
Labeling、Popup、Visualization。Dashboard(2)。Attribute Rules(3)
全局变量:制定表达式里使用的变量
$datastore $feature $layer $map $value $view.scale
这些全局变量被表达式操纵,以生成想要的输出。
表达式的基本语法
输出值、变量、常量、方法、文字、操作符
使用模式(工作流)
Profile 评估和理解上下文决定提供给表达式的全局变量。Arcade语言提供工具构建表达式的方式有 变量和数据结构,条件语句、循环结构、数学、逻辑、和字符串操作符、用户定义的方法 和 以上所有的集合。
Arcade表达式的基本特征:
1.不区分大小写
2.单行注释//多行注释/* */
3.语句可以跨多行。
4.多条语句以分号分隔,以分号结束语句
5.变量声明使用var
6.使用全局变量获取要素属性。$feature.attributeField
(1)获得连接的数据 $feature.[TABLENAME.POP21] 连接由表格点字段名称组合周围的括号表示
(2)访问图层中的所有要素 $layer
7.使用return返回结果。
相似的编程
数据类型
数组 [name,temp,wind,rh]
布尔 true
时间 Date(2022,3,2)
数据字典 Dictionary("Speed",10,"DIRECTION","southwest");
数值 65
文本 "你好"
操作符
数学运算符-- + - * /
增量运算符-- i++ j--
比较运算符-- == != > <
逻辑运算符-- && ||
编程语言加上一个全面的函数库,用于处理数据、处理日期、用于工作的几何函数.
数据、日期、几何、逻辑、数学、文本和跟踪的内置函数。
Sort() Now() Intersects()
isEmpty() Mean() Trim()
TrackCurrentSpeed
控制语句
条件语句
if() when()
循环语句
for(var i -0; i } 用户定义的方法 Function calculateWindSpeed(param1,param2){ } 视频字幕: Time Caption 0:01- [Rudy] Hello, and welcome to "ArcGIS Arcade: An Introduction." 0:05My name is Rudy Prosser and I'm here with my colleague Allison Rost 0:09to provide you with an overview of the ArcGIS Arcade expression language. 0:16We will introduce you to Arcade by describing 0:18what it is and how it can be used. 0:21I will describe what Arcade is, how the Arcade profiles determine where 0:25you can use Arcade, and the data you can use in your expressions. 0:30I'll then describe some of the basic characteristics of the 0:33Arcade expression language. 0:35Allison will show you how Arcade is used in ArcGIS by using it to visualize data, 0:41label features, and create content for pop-ups. 0:49The ArcGIS Arcade documentation describes Arcade as "...a portable, lightweight, 0:55and secure expression language written for use in ArcGIS." 1:00ArcGIS Arcade is portable because the Arcade expressions you write in one part 1:06of ArcGIS can be shared to the rest of ArcGIS. 1:10You can create an expression for labeling features in a web map layer, 1:14created in an ArcGIS Online or ArcGIS Enterprise, then copy and use that same 1:19expression in ArcGIS Pro for labeling features in a map layer. 1:23And finally, apply that same expression to a FeatureLayer in an 1:27ArcGIS API for JavaScript application. 1:32ArcGIS Arcade is lightweight in that you can use Arcade wherever ArcGIS runs. 1:37You can use it in desktops applications, such as ArcGIS Pro, in browser-based web 1:42applications created in ArcGIS Online or with the ArcGIS API for JavaScript, 1:47or in native applications built for mobile devices. 1:53ArcGIS Arcade is secure in that there's no executable code. 1:58The expressions you write with Arcade cannot be executed outside of ArcGIS. 2:03They only work within an ArcGIS application. 2:07The only time an Arcade expression executes is when it is used. 2:11For example, when you label features in a map, or generate the text for a pop-up, 2:16or check attribute values of a feature that was just edited. 2:20You can't use Arcade to build an application, or run an analysis, 2:24or automate a task. 2:27Arcade runs in specific, well-documented situations. 2:32It's an expression language. 2:34Arcade is used to write statements that when executed by ArcGIS 2:39return results that are used to create labels for features shown on a map, or 2:44provide values used for rendering those features, or to check a feature class 2:49in the geodatabase for valid and invalid attribute data, or to format the data 2:54shown in an ArcGIS dashboards element. 2:58ArcGIS Arcade is a focused language for specifically defined uses in ArcGIS. 3:04Arcade was written to help you make better maps, better interactive apps, 3:09or to provide higher-quality data, or to make data easier to understand. 3:16Arcade does this through the use of profiles. 3:19A profile is a context in which an Arcade expression is evaluated and understood. 3:25Each profile provides specific inputs that you can use in the expression and 3:30expects specific outputs. 3:33Some profiles are generic and usable in more than one part of ArcGIS, for example, 3:38labeling, pop-up, and visualization. 3:41Other profiles are only available in specific parts of ArcGIS, for example, 3:46the dashboard profile is specific to ArcGIS dashboards. 3:51Currently, there are 15 profiles, with 2 profiles, attribute rules 3:56and dashboard, providing more than one sub-profile. 4:01Each profile makes data available to the expression using global variables. 4:06The number of global variables for use in an expression depends 4:09on the profile chosen. 4:12Some profiles supply multiple global variables, other profiles provide only 4:17one or none. 4:19And all these global variables are defined with a dollar sign 4:23as their first character. 4:26These global variables are the inputs which are manipulated by the expression 4:30to generate the desired output. 4:34An Arcade expression is a combination of these global variables 4:38along with constants, variables that you define, 4:42operators and functions organized into one or more ordered statements, 4:48instructions on the operations to perform and the order to perform them in, 4:53returning a value that you can use. 4:56For example, we need to label-able weather stations on our map with each station's 5:02name plus the current temperature and humidity. 5:06We can build an Arcade expression which will provide the text to do just that. 5:11The Arcade language sets the operators, functions, and some of the specific 5:15constants you can use. 5:17The Arcade profile determines the data your expression can manipulate. 5:22You write the expression and ArcGIS evaluates it, generating a 5:27result used to label the features. 5:31Like many of the tasks you perform using ArcGIS, there's a pattern or workflow you 5:36can use when building an Arcade expression. 5:40What you need to do determines the profile you will use, for example, 5:44labeling, or pop-up or, visualization. 5:48The profile identifies the context where the Arcade expression is 5:51evaluated and understood. 5:54The profile also determines the global variables available 5:57for use in the expression. 6:00The global variables provide the data for the expression. 6:03The Arcade language provides the tools for building the expression in the way 6:08of variables and data structures, conditional statements, 6:11looping structures, mathematical, logical, and string operators, 6:16user-defined functions, and the comprehensive collection 6:20of functions you can use to manipulate the data. 6:22The expression, when evaluated, returns the result you need. 6:29Let's take a look at some of the basic characteristics of the 6:32Arcade expression language. 6:35On the left, you see an Arcade expression used to label weather stations. 6:40Some characteristics of Arcade are, it's not case sensitive, 6:44it supports both single line and multiline comments, 6:47a single statement Arcade can span multiple lines, an Arcade expression can 6:54be multiple statements with each statement separated by a semicolon, and all 6:59statements are terminated by semicolons. 7:04Other characteristics are that all variables are declared using var. 7:10You can access feature attributes using the $feature global variable 7:14plus the name of the attribute field values are to be drawn from. 7:18You can access joined data using the $feature global variable 7:23plus the table and field name you're drawing values from. 7:28Joins are indicated by brackets around the table dot field name combination. 7:33You can also access all the features in a layer using the $layer 7:37global variable, and expression results are returned with a return statement. 7:45Another characteristic of Arcade is that it provides familiar programming 7:49data types, array, Boolean, data dictionary, number, and text 7:55as well as ArcGIS-specific data types such as attachments, 7:59FeatureSets, geometry, and portal. 8:04The ArcGIS Arcade language also provides standard operators used in most scripting 8:09and programming languages plus a comprehensive library of functions 8:14for manipulating data, working with dates, geometry functions for working 8:19with spatial data, logical functions, standard mathematical and 8:23statistical functions, and string manipulation functions as well 8:27as tracking functions. 8:31You also get the same flow of control statements you see in other programming 8:34and scripting languages, conditional statements 8:37for making comparisons, looping statements for iterating 8:41through arrays, dictionaries, and FeatureSets, plus you can define 8:45your own functions. 8:49This was a quick look at the Arcade expression language. 8:51You'll find details in the ArcGIS Arcade documentation on the 8:56ArcGIS developer website. 8:58Now, I'd like to turn the presentation over to Allison, so she can show us how 9:02ArcGIS Arcade is used by showing us it in use. 9:09- [Allison] Thanks, Rudy. Now that you understand 9:11the basic structure and logic of ArcGIS Arcade, 9:14I'm going to show you some of the different ways ArcGIS Arcade can be used 9:18to execute custom expressions across ArcGIS. 9:22First, we'll look at how you can start using the labeling and field calculate 9:26profiles in ArcGIS Pro. 9:29We're going to start with writing a custom label expression. 9:32In ArcGIS Pro, I select the layer, the Labeling tab, and then click Label 9:41to enable labels for my layer. 9:43My weather station points are currently being labeled by the OBJECTD field. 9:48I'm going to use the drop down to change the label field to STATION_NAME. 9:56Now you see all of the features of my map are labeled with their station name. 10:01I'm going to go ahead and use ArcGIS Arcade to create a custom expression that 10:05will stack the values from a second field below the station name 10:09for each of my points. 10:11I can do that by clicking on the Expression button. 10:16That opens the Label Class dialog where I can access the expression box. 10:20The expression box has already been populated with the global variable 10:25$feature.STATION_NAME. 10:27When this label expression is applied, the value for a station name is placed as 10:32a label next to each feature. 10:35To create our custom expression, I'm going to use an Arcade constant. 10:40I'm going to add a plus sign, and then I'm going to add the constant, 10:45TextFormatting.NewLine. 10:52This is what's going to force the values from the second field onto a new line 10:57beneath the station name. 11:00I'm going to add a second plus sign, and then I'm going to select the 11:04global variable, $feature.TEMP, from the field list. 11:11I'm going to go ahead and Verify my expression, and it comes back as valid, 11:17so I can Apply. 11:19And now you can see, I have a stacked label with station name 11:23appearing above the current temperature. 11:26Now, I don't really like how my temperature is being 11:28displayed for all my features. 11:31You can see that some of them go out in multiple decimal places. 11:34Instead of adding a new field to the attribute table of my weather 11:38stations layer, I'm going to go ahead and use an Arcade math function called 11:42Round to round my temperature values to zero decimal places. 11:48To do this, in the expression box, I'm going to add 11:52Round an open parenthesis. 11:57Then after the global variable, I'm going to add a comma and tell it, 12:02I want it to round to zero decimal places. 12:05Then I'm going to add a close parenthesis. 12:09I'm going to Verify and it says my expression is valid, so I'm going to go 12:14ahead and Apply. 12:17All right, so this is looking better, but it still isn't 12:20clear that the second value is a temperature. 12:23So I'm going to make one more modification to my expression. 12:27I'm going to go ahead and add some text to the end of my expression by adding a 12:33plus sign and then the text between two quotation marks. 12:41I'll Verify my expression again and then Apply. 12:47Now that we have a well-formed stacked label, I'm going to go ahead and share 12:52this web map to ArcGIS Online, so we can use it for another demo. 12:56I'll do this by clicking Share, Web Map, completing the required information... 13:14...analyzing, and then clicking Share. 13:21While this is publishing, we're going to look at another way we can 13:26label this map using text formatting tags. 13:30Here, we have a duplicate of the map we were just working on, 13:34we used Arcade to create a simple stacked label that we shared to ArcGIS Online. 13:40If you need to create complex labels for an ArcGIS Pro project, 13:45you could choose to use text formatting tags to set the font, font size, color, 13:52style, spacing, background color, and more, 13:55to different sections of your labels. 13:59If we go back to the labeling dialog... 14:06...we can add text formatting tags to the expression in the expression box. 14:11Let's say I want to change the color of the station name to red. 14:15I can do that by adding a color formatting tag around STATION_NAME. 14:40After I add the tag, at the end, I have to close the tag. 14:50Then I can Verify and my expression is valid so I can Apply. 14:55I like this better, but I think it would stand out more if I also made the 15:01station name bold. 15:03I can do this by adding a bold tag. 15:07So right before the color tag, I'm going to add bold, and then 15:15right after, I'm going to close it. 15:24My expression is valid so I can Apply. Okay. 15:30This is looking good for station names, but the temperature 15:33is getting a little lost. 15:35I'm going to resolve this by increasing the size of the font for the temperature 15:38using a font tag. 15:41I'm going to add it before I round the temperature value. 15:50And it's going to be font size equals, and I'm going to go ahead and 15:55make it 12.5. And then I'm going to close our tag. 16:11I'm going to Verify my expression, my expression is valid so now, I can Apply. 16:20I'm happy with these labels. 16:22Just keep in mind that the text formatting tags can only be used in ArcGIS Pro, so I 16:28don't want to share this version of my map as a web map. 16:31Now, before we leave ArcGIS Pro, I want to take a look at one more Arcade 16:35profile called field calculate. 16:39To do that, we're going to navigate to one more map. 16:44In this map, I have a polygon layer that I created from a land cover raster. 16:50I have the grid code from the raster, but I want to add a field to the attribute 16:54table with the land cover description of each code. 16:57When I open the Attribute Table, you see that I've already added a text 17:03field for the land cover description. 17:07I'm going to right-click on that field and click on Calculate Field to open 17:12the field calculator. 17:15I'm going to resize it, and then I'm going to change the expression type from 17:22Python 3 to Arcade. 17:27The first thing I'm going to do is I'm going to create a variable to hold a 17:32dictionary of name value pairs that represent the gridcode 17:37values and their associated descriptions. 17:46One thing to take note of, even though the name value is a number, 17:49in my dictionary, it's always treated as text. 17:53Since the gridcode field is a numeric field, I'll have to cast it into text 17:58in order to compare the two values. 18:00To handle this comparison, I'm going to use a series of if statements. 18:10My first if statement will tell the calculator what to do if the 18:13gridcode is null. 18:15If gridcode is null, I want it to just go ahead and continue. 18:24If gridcode equals equals null... 18:33...continue. 18:35And I'm going to close that expression. 18:39My second if statement will look for any numeric values that are less than 10. 18:44The reason I'm looking for any single digit values is because in order to use 18:49the text function to convert the numeric gridcode into text, 18:54I have to tell the function how to format the result. 18:57I do this by specifying how many digits to the left of the decimal place should be 19:02considered by placing a single zero at the end. 19:06This is what the expression looks like. 19:10If gridcode is less than 10, I'm going to have it return the dictionary 19:24value that matches the Text of gridcode... 19:40...to one decimal place. 19:47And then we're going to close our expression. 19:52I'm going to go ahead and Verify, and my expression is valid. 20:00My third statement will look for any numeric values that are 10 or greater. 20:04That way, I can set the format for these values to two digits 20:08to the left of the decimal place. 20:14I'm going to go ahead and copy my previous statement and change it to 20:22greater than or equal to 10. 20:24Then, I'm going to add a second zero to represent that second decimal place. 20:32I'm going to go ahead and Verify my expression again, and it's valid, 20:38so I'm going to go ahead and Apply it. 20:47And now, you can see the description field has been populated with the value that 20:51corresponds to the gridcode. 20:54If I do a sort descending, my woody wetlands are a gridcode 90. 20:59Sort ascending, my barren land is a gridcode of 31. 21:03These were just a few examples of how ArcGIS Arcade can be used in ArcGIS Pro. 21:08In my next demo, I'll show some examples of using the visualization and pop-up 21:13profiles in ArcGIS Online. 21:21In this demo, we transitioned from ArcGIS Pro to ArcGIS Online. 21:27I want to start by emphasizing that ArcGIS Arcade is portable, 21:32meaning it can be used across ArcGIS. 21:35This is the weather map of stations I shared from ArcGIS Pro to ArcGIS Online 21:39in my previous demo. 21:42As you can see, each station has an associated stacked label. 21:46We can review the Arcade expression used to label these features by clicking 21:51on Layers, selecting the layer, selecting Labels, opening our Custom label 22:02field expression, and reviewing the expression in the dialog. 22:09So as you can see, the same custom expression that we wrote in ArcGIS Pro is 22:15still being applied in an ArcGIS Online web map. 22:18If we wanted to change or modify our expression, we'd be able to do so 22:22in this dialog. 22:24Through it, you have access to your global variables, a list of Functions, 22:30and Constants, like TextFormatting.NewLine, 22:34that we're using in our current expression. 22:36I'm not going to change our expression right now, 22:38so I'm going to go ahead and tell it OK. 22:42Next, we're going to take a look at how you can use Arcade to create a custom 22:46style for the features in your map. 22:49Before we start styling our map, I'm going to go ahead and change the 22:52visible range for our labels to countries-small. 23:00Then I'm going to zoom out so we can see more of our features. 23:06Since our weather stations layer is still selected, I'm going to go ahead and click 23:10on Styles to open the Styles pane. 23:13The weather station points currently have a single symbol applied. 23:16I'm going to write a custom attribute expression in Arcade to help me style this 23:20layer so that it's easy to identify areas with cold, mild, and hot temperatures. 23:26To do that, I'm going to click on Expression to access the editor window. 23:30The first thing I like to do in the editor window is 23:33to create a name for the expression. 23:36This makes it easier to identify it if I end up writing more than one. 23:41So I'm going to go ahead and change the name to Temp Categories, 23:49and then I'm going to click Save. 23:53For this expression, I'm going to use a logic function called 23:56When to evaluate the value in the temp field and return a defined label. 24:02I'm going to start by defining a variable called tempcategory, 24:07which I'm going to set as equal to the result of When. 24:10So variable tempcategory equals to When. 24:17And to make this a little easier for you to read, I'm just going to 24:21go ahead and space it out a little. 24:23And so I'm going to get the Round of our global variable TEMP 24:31to the zero decimal place. 24:35And when that value is less than or equal to 32, I would like it to return 24:42"Below Freezing" and I'm going to go ahead and reuse. 24:53So if that value is greater than 32 and less than 60, then I'd like it to return 25:10"Cool to Mild." 25:17And finally, if the value is greater than or equal to 60, I'd like it to return 25:30"Warm to Hot." 25:34And with When, I need to provide a final value that will be returned in the event 25:40that none of these expressions return true. 25:43So I'm just going to make that null. 25:46So if none of these are true, I'm going to get null back. 25:53I'm going to return the result of When. 26:02There we go. And then I am going to Test to make sure that my expression is valid. 26:10So as you see, the result was below freezing so I know that my 26:15expression works successfully. 26:18So I'm going to go ahead and tell it OK. 26:20And as you can see, my expression is now accessible under choose attributes. 26:26And thanks to smart mapping, the weather stations now have a unique 26:31symbol style applied. 26:33So I'm just going to go ahead and click on Style options, and then I'm going to 26:37switch out the color ramp for something that is a little more 26:40representative of temperatures. 26:44Then I'm just going to tell it Done and Done, and my features look great. 26:49So I'm almost ready to share my map. 26:52There's one more option that I want to configure for my weather stations before I 26:56share this out, and that's going to be the pop-ups. 26:59I'm going to click on Configure pop-ups to open the pop-ups pane and an example of my 27:05current pop-up configuration. 27:07The {STATION_NAME} is currently being used as a title for my pop-up, but I'd 27:13like to improve it by adding the state. 27:15In the field list, by default, all the fields in my layer are listed. 27:19I have a lot of fields that aren't relevant for my audience like OBJECTID, 27:26that aren't formatted like TEMP, or that lack context like the ICAO field. 27:35So I'm going to go ahead and reconfigure the pop-ups using Arcade expressions. 27:39So only necessary and well-formatted fields appear in the pop-up window. 27:44The first thing I'm going to do is go ahead and remove all the fields from my 27:48pop-up by clicking Fields list, and then 27:51clicking X to remove the ones I don't want. 28:05Now I'm ready to start adding my expressions. 28:07I'm going to go ahead and close my field list, and I'm going to click 28:11on Manage expressions. 28:14This is where I can access the Add expression button and open up my editor. 28:21I'm going to go ahead and create an expression to use 28:23as the title of my pop-up. 28:25So I'm going to go ahead and edit the name, and I'm going to call this 28:31Station and State. 28:37Now we're ready to start writing our expression. 28:39But you may notice something different about some of the global variables 28:43that we now have access to. 28:45We've been working with $feature up to this point but we now have three 28:49additional options that I want to take a moment to discuss. 28:52The first is $layer. 28:55$layer is actually, in this case, a FeatureSet. 28:58A FeatureSet represents a connection to a set of features. 29:02So if I wanted to find the maximum value of an entire field, 29:07I'd use the $layer variable. 29:10The next I'm going to point to is $map. 29:13The $map variable is a FeatureSet collection which gives you access 29:18to FeatureLayers in the same map so you could access field values or geometry 29:25of other layers to use in the calculation of your expression. 29:29The last is $datastore. So a $datastore is also a type of FeatureSet collection, 29:35and this gives you access to layers in the same feature service or database as the 29:40layer whose pop-ups are being configured even 29:44if they haven't been added to the map. 29:46In this example, we're going to continue using our $feature global variable. 29:50So I'm just going to go ahead and click on the arrow to access my fields, and I'm 29:56going to go ahead and add my STATION_NAME. 30:03Now, the field that contains the state information also contains the country, 30:08and I'd like to remove the country because it makes the title a little too long. 30:12So I'm going to use a Replace function to remove 30:16the text that I'm not interested in. 30:18I'm going to do that by adding a plus sign, and then a comma and a space so my 30:23title is easy to read. 30:26I'm going to add another plus sign, and then Replace, 30:30and then I'm going to find my country field. 30:33Going to add COUNTRY, and then I'm going to tell it what text to remove, 30:40United States of America. 30:45And then I'm going to tell it what to replace it with, which in this instance, 30:49is going to be nothing. Make sure that's closed. All right. 30:54And now, let's go ahead and Test. 30:57Well, as you see, I have an extra comma. 31:00So let's go ahead and remove that. 31:05So it would be comma, space, United States of America. 31:09Let's try this one more time. There we go. Much better. 31:12So now, we have our title expression ready. I'm going to go ahead and click OK. 31:17And now, you can see that it's been added right here in our pop-up expressions pane. 31:24We're going to go ahead and add a few more expressions, and then we're going to apply 31:27these to our pop-up. 31:29So the first additional expression we're going to add, 31:32we're going to call Temperature. 31:40That's just going to Round our temperature like we've done 31:42before and add degree Fahrenheit. 31:45Let's get and Test it. 31:48So I'm going to go ahead and tell this one, OK. 31:52Our next expression, we're going to call Wind Chill. 32:01Okay. 32:05And we're just going to Round Wind_Chill and then add degrees Fahrenheit again. 32:08Let's Test it. 32:11Looks good, so we're going to tell this, OK. 32:14And then our last expression, we're going to call Wind Direction. 32:24I'm just going to tell this to Save, and we're going to write this expression 32:29similar to what we did in one of our previous expressions when 32:33we use the When function. 32:35So we're going to add two variables, one for wind direction, 32:39and one for WIND_SPEED, then we're going to create 32:42a variable for the wind function. 32:45In this case, we're first going to look at SPEED and if it's zero, 32:48we're not going to assign a direction. 32:50Then we're going to look at direction and to determine whether the wind is 32:53blowing north, northeast, east, southeast, south, southwest, etc. 32:59And if none of these are true, then we're just going to return, null. 33:03So the last thing we're going to do is return SPEED plus miles per hour, 33:15because we'd like it to have a label, and then the direction 33:19from our When function. Let's go ahead and give this a Test. 33:25Nine miles per hour west. That looks good to me. 33:27And we're going to tell it, OK. 33:30And now we're ready to configure our pop-ups by applying our expressions. 33:34So we're going to go back, and then we're going to first change our {STATION_NAME}. 33:40I'm going to remove the current title. 33:44I'm going to click on the option to open my field list. 33:48And as you go through the field list, you're going to see my expression, 33:52state and station is now available. 33:55I'm going to go ahead and click on state and station and apply that. 33:59All right. So that's looking a little better. 34:01And now when I click on my field list, I'm going to be able to click 34:06on Select fields. 34:08And again, you're going to see my expressions available. 34:11So here's Temperature, Wind Chill, and Wind Direction, and I can click Done. 34:16And now, my pop-up has been configured and I'm ready to share my map. 34:22For our next demo, we'll look at using ArcGIS Arcade to configure 34:27an ArcGIS dashboard. 34:31In this demo, we're going to take a look at how ArcGIS Arcade can be used to help 34:35configure an ArcGIS dashboard. 34:38I have a simple dashboard here that I created using our temperature labels map 34:42that we created and configured in the previous two demos. 34:46Right now, it's set with historic data, and there's an option to filter that data 34:51based on dates. 34:53I'm going to go ahead and select a date so we have some data to work with. 34:59Now, our points are available, and there's a list of areas that had a wind speed 35:05greater than 37 miles per hour and an average indicator. 35:10So the average on this day was 19.9 miles per hour. 35:14We're going to use Arcade to reformat these two elements. 35:17We're going to start with formatting the list element. 35:20My goal is to create an expression that sets the background color for each of the 35:24list items based on the wind speed. 35:27To do this, I'm going to hover over the list, select Configure, click on List, 35:34and then I can Enable advanced formatting. 35:38In the expression box, a return has already been set up for me 35:41that includes the default system-defined properties. 35:44In this instance, system-defined properties are settings you would 35:48otherwise configure in an element, such as text and background color. 35:53For this expression, I'm going to use a logic function 35:55called IIF, which is going to evaluate a condition and return one result if it's 36:00true and another if it's false. 36:04I'm going to make this a little larger and set up a variable called speedColor and 36:14set that equal to IIF WIND_SPEED is greater than or equal to 51. 36:29And then I just have two hex codes. 36:31So if it's greater than or equal to 51, it'll be red-orange, 36:34and if not, it will be yellow. 36:38So in order to apply my new speedColor variable, I'm going to take the variable 36:44name and place it next to backgroundColor. And let's just give this a Test. 36:52And now you see, when I look at my result, the value for backgroundColor 36:57is one of my hex codes. 36:59There's one more change that I want to make before we leave the advanced 37:02formatting editor, and that's going to be adding the state after the station name. 37:08To do that, I'm going to create one more variable for stateName. 37:12And as you remember, I was getting state name from 37:17the country which also included the country. 37:19So I'm going to use Replace to remove the COUNTRY 37:24so that I'm just sharing the state name. 37:29So I'm going to put United States of America, and then I'm going to set the 37:38result as blank because I don't want it to return anything. 37:41So now, we're going to go back over to my return, and you'll see there's no 37:46system-defined property for text. 37:49So what I need to do is add my variable as an attribute. 37:53So there's a predefined attribute dictionary. 37:57So I'm going to ho head and uncomment these lines, 38:00and it gives me this syntax here. 38:04I'm just going to remove this and put state, and then I would like state to be 38:10equal to my stateName. 38:14Okay? Let's go ahead and Test this. All right. 38:16So now we see my attributes return dictionary and my 38:19backgroundColor returns my hex. 38:21So I'm going to go ahead and go back over to my List options and then scroll 38:27down to my Line item template. 38:30So {STATION_NAME} is currently what's set for my line item. 38:34I'm going to add a comma and a space, and then I'm going 38:37to add the state attribute that I created. 38:40So expression/state. All right. So that's looking better. 38:45Now I have both the station name and the state. 38:48So I'm going to go ahead and say, Done. 38:51And now, you can see my list element shows weather stations with wind speeds greater 38:56than or equal to 37 miles per hour in yellow and weather stations reporting wind 39:01speeds greater than or equal to 51 miles per hour in red. 39:05And finally, we're going to configure this indicator so that the custom wind icon 39:09that I uploaded only appears when the average 39:12wind speed is over 10 miles per hour. 39:15To do that, we're going to start configuring our indicator. 39:20We're going to click on Indicator, and then we're going 39:23to Enable advanced formatting. 39:27If I scroll to the bottom of the indicator options pane, you'll see the custom icon 39:32I added, its name is icon1. 39:35So we're going to scroll back up, and we're going to write an expression that 39:40displays icon1 when the average wind speed is greater than or equal to 39:4510 miles per hour. 39:47To get a little more room, I'm going to go ahead and expand 39:49our editor, then I'm going to create a variable that's going to reference icon1. 39:59Next, I'm going to create an if statement. 40:02So if WIND_SPEED is less than 10...I would like icon to be blank. 40:16So now, we're ready to set the icon name in our system-defined properties 40:22to our icon variable. 40:26And now, I can do a couple of quick improvements. 40:28I'm going to go ahead and round the WIND_SPEED that appears in my indicator, 40:34and I'm also going to add some topText. 40:39So it's really easy to make changes by filling out the system-defined properties. 40:43So I'm just going to make this "Average Wind Speed" so folks understand what the 40:48indicator is meant to show. 40:51Now, whether the icon appears or not in our Test will depend on what wind speed is 40:57currently being considered. 40:59So just because it's not here doesn't mean it's not working. 41:02Let's go ahead and exit out of the expanded view, go back 41:06over to our indicator options. 41:08All right, and now we see 17 miles per hour for an average and I do see my icon. 41:13So let's go ahead and click Done. And we are going to test this out. 41:18So here, we have an average wind speed of 20 miles per hour. 41:21So let's go ahead and change the dates. 41:27And now, we have an average wind speed of 10 and you can see that my icon is gone. 41:32One last thing that I want to point out about this dashboard is I can click on a 41:37location and as you see, the labels that I set up in ArcGIS Pro, 41:45and if I click on one of the weather stations, the pop-up that I configured 41:49in Map Viewer is still accessible. 41:52For my last demo, I'm going to show some examples of using ArcGIS Arcade in a 41:56JavaScript application, and then show you where you can get 41:59started using ArcGIS Arcade. 42:05As you've seen in my prior demos, it's easy to use 42:08ArcGIS Arcade across ArcGIS. 42:11Now we're going to take a look at how you can use ArcGIS Arcade 42:14in a custom JavaScript application. 42:16On the left, I have the code for my application. 42:20It was written using the ArcGIS JavaScript API, Version 4.19. 42:25Currently, all it's doing is grabbing the WebMap and weather stations layer that I 42:30published from ArcGIS Pro in one of my prior demos. 42:34If we go over to the map, you'll see that we can interact 42:37with it just like we did the web map. 42:39I can click on a feature and return with the formatted pop-ups. 42:44If I zoom in on the map, you'll see that my labels appear. 42:51But what if my layer didn't currently have labels applied? 42:54I could use ArcGIS Arcade within my JavaScript application to create labels. 43:01I'm going to show you what that looks like. 43:03So I have a second demo here, and you see that I have labels that now appear 43:08for the entire United States. 43:11These labels look a little bit different because I've added the wind speed. 43:14And that was done in the JavaScript API by adding a script element, 43:22and I think the syntax is going to look familiar. 43:25We set our variable for wind direction, we set our variable for WIND_SPEED, 43:30and then we set a variable that calls the When function. 43:35These are all expressions that I demonstrated writing in my previous demos. 43:42In the end, we returned concatenated labels and we format it with 43:48TextFormatting.NewLine, then we close our script element, and we're 43:53going to call it within our script. 43:57Within labelingInfo, we're going to call labelExpressionInfo 44:03and then we're going to have that expression, getElementById, 44:07our label-expression. 44:09And it's as easy as that to relabel a map using Arcade in the JavaScript API. 44:16By now, you might be wondering, "How can I get started 44:18with ArcGIS Arcade?" 44:20So I want to point out that at developers.arcgis.com/arcade, 44:26you're going to find the ArcGIS Arcade documentation. 44:30We have a Guide that includes Getting Started and sections on Structure and 44:34Logic that explains some of the concepts that Rudy went over earlier. 44:40There's a Function Reference where you can look up the syntax for all of the 44:43different functions, and there's even an ArcGIS Arcade playground where you can 44:48access different profiles to test Arcade syntax and functions. 44:54This concludes the technical presentation.