BLOG
|
If you’re using an iOS device to collect data with ArcGIS Field Maps, you may run into an error when attaching large video files to the form. To avoid this problem, you can set up an iOS shortcut to reduce the file size of your video. Shortcuts on iOS trigger a series of actions that are used to complete a task, such as reducing a video. After creating the shortcut, you can access it from the home screen of your device and from the Share Sheet in iOS, which can be helpful for exporting videos from other apps (e.g., Go Pro’s QUIKC app). Shortcut on home screen and Share Sheet In this step-by-step tutorial, you’ll learn how to create a shortcut that reduces the file size of a video and saves it as a new item on your device. We’ve published a public version of this shortcut if you’d like to use it as you follow along. Note: The screenshots for this post were taken using an iPhone. If you’re using an iPad, the screens will look different. Step 1—Tap on the Shortcuts app on your device’s home screen. Alt text: Shortcuts app Step 2—Once you’re in the app, tap the Add button to start creating a new shortcut. Alt text: Add button A builder appears where you can configure and create your shortcut. New shortcut Step 3—Change the title of the shortcut by tapping the drop-down menu next to New Shortcut and then tapping Rename. Rename the shortcut to something easily identifiable, such as Reduce Video. Rename shortcut Step 4—Tap the Info icon at the bottom of the screen. Step 5—On the Details tab that appears, enable the Show in Share Sheet toggle button so the shortcut appears on the Share Sheet for other apps. Shortcut details Step 6—Tap Add to home Screen. Here, you can customize how the shortcut appears on the home screen. Customize shortcut appearance Step 7—Return to the Shortcuts app. Now, you’ll add a series of actions that, when triggered, will reduce the file size of a video. The actions will account for two scenarios: Reducing file size when the shortcut is tapped on the share sheet Reducing file size when the shortcut is tapped on the home screen The first action is added by default since you enabled the Show in Share Sheet toggle button. Default Share Sheet action Step 8—Tap Images and 18 more and tap Clear to unselect every option. Then enable the Media toggle button. Unselect everything but Media This ensures the shortcut will only appear in the Share Sheet when media is being shared (such as videos). Step 9—In the Search bar, search for and add an If statement to the shortcut. Add If statement to the shortcut Step 10—Define the If statement as follows: In the If box, tap Condition and select has any value. Underneath the If box, search for and add the Get Item from List action, then drag it below the If box. Tap List on the action and select Shortcut Input. Underneath the Otherwise box, search for and add the Select photos action, then drag it below the Otherwise box. Next to Include, tap All and select Videos. Before the shortcut reduces the video size, it will use this statement to determine whether the video is coming from a file’s share sheet, or if the user is selecting a video after tapping the shortcut on the home screen (and then prompts the user to select a video). The statement should look like the following image: Alt text: Completed If statement Step 11—Search for and add the Encode Media action. Select Media and select If Result (which I’ve renamed to Selected Video), so the shortcut encodes the video selected by the user. Encode Selected Video Step 12—Next to Size, tap Passthrough and select Ask Each Time so users are prompted to select the new size of the video each item they use the shortcut. Ask for size each time Once configured, the Encode action should look like the following: Configured Encode action Step 13—Search for and add the Save to Photo Album action and change the action’s Input to Encoded Media. Step 14—Search for and add the Photos Open Collection action and change Collection to Recents. The final two actions will save the reduced video file to your recents album and then open that album to the file’s location. Save and open the video Step 15—Review your shortcut. Review the shortcut to make sure your actions are configured properly. We've published a complete version of the shortcut you can use as reference (must be opened on an iOS device). Step 16—Test your shortcut. Once you’ve reviewed the shortcut, give it a try! Tap the Reduce Video shortcut from the home screen or share sheet, select the file size to reduce it to, and view the result in your recents photo album.
... View more
a week ago
|
4
|
0
|
224
|
POST
|
Hi @LindseyGreidanus , Thank you for your feedback! There was unfortunately a typo in the documentation for the casing of this parameter, which is why it wasn't working for you. It should be workOrderId. The documentation has since been updated to include this correction: Open the Workforce web app from a link. Thank you, Josh
... View more
10-30-2023
07:33 AM
|
2
|
0
|
494
|
BLOG
|
Hey Gary - Field Maps Designer is tied to the release of ArcGIS Enterprise, so unfortunately there is no way to update Field Maps Designer in your instance of 11.0. To get the "New map" button, and other updates, you would have to update your entire instance of ArcGIS Enterprise to a later version (11.1). At least I think this is what you're getting at! Please let me know if otherwise. Josh
... View more
10-10-2023
10:36 AM
|
0
|
0
|
408
|
BLOG
|
Hi Gary, Thank you for your comment! That's expected. The "New map" button, and the ability to create new maps and layers in Field Maps Designer, is available in ArcGIS Enterprise 11.1 and later and is not available in 11.0. Thank you, Josh
... View more
10-10-2023
06:37 AM
|
0
|
0
|
436
|
BLOG
|
With the Field Maps Designer web app, you can streamline your field workflows by creating the maps and forms mobile workers use in the Field Maps mobile app. If you're using Field Maps Designer on ArcGIS Enterprise, the available features depend on the version of Enterprise that you're using. The Field Maps team has created the following document so you can quickly reference which features of Field Maps Designer are available on each version of ArcGIS Enterprise: Support for Field Maps Designer on ArcGIS Enterprise (PDF). For more information about Field Maps Designer, see the following resources: Get started with Field Maps Designer (tutorial series) Configure the map (help topic) Configure the form (help topics)
... View more
08-08-2023
06:00 AM
|
5
|
6
|
1117
|
BLOG
|
It's the first day of #FieldMapsMonday, a a new content series for the month of May! Each Monday we'll be dropping short videos that highlight the capabilities of ArcGIS Field Maps. To kick off the series, we're starting with a video all about the Field Maps Designer web app. With Field Maps Designer, you can create and prepare the maps mobile workers use in the Field Maps mobile app. From building forms to defining geofences, there are so many ways for you to customize and streamline your mobile workflows. Watch the video to learn more: Get to Know Field Maps Designer.
... View more
05-01-2023
12:24 PM
|
5
|
0
|
457
|
BLOG
|
By Josh Clifford and D’Maia Curry In September 2021, the Field Apps team released the ArcGIS Field Maps app for Integromat. Integromat allows you to create webhooks and connect Field Maps with other apps and services to automate your field workflows. Want to automatically send an email every time a feature is collected in the field? There's a webhook for that. Want to automatically generate an assignment in ArcGIS Workforce after an asset has been inspected? There's a webhook for that too. We've created a variety of resources to help you get started: - ArcGIS Field Maps app for Integromat released! (Sept 2021) (Blog post) - ArcGIS Field Maps: Automate Email Notifications Using Integromat (Video) - Automate email notifications for field updates (Blog post) - Automatically create Workforce assignments after an inspection (Blog post) - Connect Field Maps and Cityworks with Integromat (Blog post) - Automate Field Maps (Help topic) In addition to these resources, Integromat provides several templates you can use to construct your webhook. How will you use Integromat to automate field workflows? Let us know in the comments below!
... View more
12-14-2021
01:50 PM
|
0
|
0
|
461
|
BLOG
|
The Field Apps team wants to ensure you have all the resources you need to be successful in learning how to use our products. For this reason, we are looking to get your feedback from our learning resources survey. Answers to these questions will help us improve our ability to ensure your success when using field apps. This survey will ask about your learning style, content preferences, and opinions on our documentation as it exists today. While Field Maps is the only product mentioned, we’d like to hear your feedback if you use any of the ArcGIS Field Apps. The survey will close on March 18, 2021. Thank you in advance for helping us improve our content, and please share this survey with anyone else you know who uses ArcGIS Field Apps. We look forward to hearing from you! Take the survey today.
... View more
03-01-2021
12:59 PM
|
0
|
0
|
422
|
POST
|
Hi @Anonymous User , The Try Data Collection Discovery path includes three blog articles that go over how to create, configure, and use a map for collecting data in a hypothetical park. Is this what you're referring to? Thanks, Josh
... View more
12-30-2020
12:44 PM
|
0
|
3
|
1049
|
BLOG
|
Hi @EdFarrell - thank you for your comment. In order to automate new Workforce projects (that are enabled for offline use), you need to use version 1.8.3 of ArcGIS API for Python. Version 1.8.3 is set to release later this year, but you can download and use the prerelease today. The workforce-scripts GitHub repository includes version 1.8.3 and instructions on how to install it. You can also install version 1.8.3 by following the steps listed out in the Workforce doc. Once you install this version, the code should work as expected. Please let me know if you have any questions. Josh
... View more
11-12-2020
02:02 PM
|
0
|
0
|
3331
|
BLOG
|
Take automation to the next level by scheduling tasks for Workforce for ArcGIS. If you are operating on a Windows machine, you can use the Windows task scheduler to automatically run Python scripts for your Workforce project at a customized date and time. Here are a couple of examples of when you might want to schedule a Python script for Workforce: You want a daily report of all completed assignments, so you schedule the export_assignments_to_csv script to run at the end of each day. Every two weeks, you want to reset workers within your project to a status of “not working”, so you schedule the reset_stale_workers script to run every other Sunday. All of the available Python scripts for Workforce are found in the workforce-scripts GitHub repository. If you are new to automating tasks for Workforce, you may want to check out this introductory blog series first: Automating Workforce with ArcGIS API for Python. For this exercise, you will schedule the reset_stale_workers script using the Windows task scheduler. You can also use any script that makes sense for your Workforce project. Overview Create the Python environment Clone the workforce-scripts repo and install dependencies Schedule the script in Windows Task Scheduler Create the Python environment First, you will create the Python environment that you'll use to run the Python scripts for Workforce. To do so, you'll first add the ArcGIS Pro helper scripts to your system path. Then you'll create a new conda environment to run the scripts in. 1. Sign into ArcGIS Pro with a licensed account. Then, exit the program. Note: ArcGIS Pro comes with ArcGIS API for Python and Conda. If you don’t have ArcGIS Pro, you will need to download and install ArcGIS API for Python separately. For more information, see Install and set up ArcGIS API for Python. 2. Add the ArcGIS Pro helper scripts that come with Pro to your system path environment variables. This will allow you to run conda in the command prompt. On your Windows device, search for and open System (control panel) In the System window, click Advanced system settings. In the System Properties window, click Environment Variables. In the Environment Variables window, under System variables, select Path. Then, click Edit. In the Edit environment variable window, click New, and add the file path to the ArcGIS Pro Python scripts. Here is the default file path: C:\Program Files\ArcGIS\Pro\bin\Python\Scripts Click OK. 3. Open the ArcGIS Python Command Prompt. This should be located in: Programs -> ArcGIS -> ArcGIS Pro -> Python Command Prompt In the command prompt, run: conda create -n workforce --clone arcgispro-py3 –y This will create a new conda environment in the following location: C:\Users\<account-name>\AppData\Local\ESRI\conda\envs\workforce This is the environment that you'll use to run the Python scripts for Workforce. Clone the workforce-scripts repo and install dependencies Next, you'll clone the Workforce scripts to your machine and install the required Python libraries needed to run them. 1. Clone or download the Workforce scripts found in the GitHub repository. 2. In the ArcGIS API for Python Command Prompt, navigate to the Workforce scripts folder: cd C:\Users\user\Desktop\workforce-script\scripts 3. Run: activate workforce 4. Install the required libraries using Python's default package installer, pip: pip install -r requirements.txt ArcGIS API for Python and the required libraries are now installed. You are now able to run Workforce scripts on your machine. Schedule a script in Windows Task Scheduler Finally, you will schedule a Python script to run using Windows Task Scheduler. You’ll schedule the reset_stale_workers script to run every other Sunday evening. 1. In the Windows Start menu, search for "Task Scheduler" and open the program. Click Actions > Create task. In the Create Task dialog box, name the task “Reset Workers” and select the Run whether user is logged on or not security option. 2. In the Create Task dialog box, click Actions > New. The New Action window appears. For the Program/script setting, copy and paste the file path for the Python environment you created earlier. The file path should read as follows, where <account-name> is your system account name: C:\Users\<account-name>\AppData\Local\ESRI\conda\envs\workforce\python.exe For the Arguments setting, enter the complete file path to the script you want to run followed by the script’s parameters. It should look like this: "<full path to reset_stale_workers.py>" -u <arcgis-username> -p <password> -org <url-to-your-organization> -project-id <project-id> -cutoff-date 1 -timezone "US/Eastern" -log-file "<full path to log.txt>" Be sure to edit the following parameters: Include the full path to your reset_stale_workers.py script. Edit the username, password, organization, and project-id to match your own credentials. Set the cutoff-date to 1. This tells your script to reset workers whose statuses haven’t changed in the past minute. Include the full path to your log.txt file. Note: If you are working with a Classic project (a v1 project), the Project ID is the item ID of the project item. If you are working with projects enabled for offline use (a v2 project), the Project ID is the item ID of the Workforce feature service. Regardless of what version you are working with, the Project ID can be found in the URL of your project. For example, if the project URL is: https://workforce.arcgis.com/projects/a0f297f949f549f0ade07eer562d9934/configure/overview The project-id is: a0f297f949f549f0ade07eer562d9934 In the Add arguments setting, add the complete file path to the script you want to run followed by the list of parameters (shown above). Click OK to close the Edit Action window. 3. Create a new trigger In the Create Task dialog box, on the Triggers tab, click New to open the New Trigger window. This is where you set how often you want your script to run. For this exercise, the script is set to run every two weeks on Sunday at 10:00PM. Click OK to close the New Trigger window. The trigger you just created is now listed in the Triggers tab. You can set multiple triggers for your script, depending on the needs of your Workforce project. Click OK to close the Reset Workers Properties window. The reset_stale_workers script is now set to run every other Sunday. If you want to test that this script will work, you can run it manually at any time. Select the script in the Task Scheduler Library and click Run. After running the script, you can view the log file to confirm that it worked.
... View more
05-14-2020
11:35 AM
|
1
|
0
|
1933
|
BLOG
|
Over time, projects in Workforce may become cluttered with assignments that are no longer needed in the regular working view of the Workforce project. The project may also contain workers who, for various reasons, have not correctly updated their working status. This blog post will teach you several ways to clean out and maintain your Workforce projects using ArcGIS API for Python. You’ll learn how to delete assignments and assignment types, how to archive assignments by copying them to a new feature layer, and how to reset workers who have been inactive. You’ll also learn how to verify assignment completion based on the completion of work orders. These scripts will make tidying up your Workforce projects a quick and efficient task. Overview Install ArcGIS API for Python Download Workforce scripts Delete assignments Delete assignment types Copy assignments to a feature layer Reset stale workers Report incomplete assignments that have completed work orders Additional resources Download Workforce scripts First, clone or download the workforce-scripts GitHub repository This contains the Python scripts for Workforce as well as the version of the Python API needed to automate Workforce projects. Once it's downloaded, navigate to the “workforce-scripts” folder in either the terminal or the command prompt. A Windows operating system is used for this example. cd C:\Users\user\Desktop\workforce-scripts Install ArcGIS API for Python To automate and script Workforce projects, you must use ArcGIS API for Python 1.8.3 or later. Version 1.8.3 is included in workforce-scripts file. Run the following command in either a Python script or Python console to create the virtual environment with the correct dependencies and to install ArcGIS API for Python 1.8.3: conda env create --file environment.yml Next, activate the environment: conda activate workforce-scripts Once you've created and activated the environment, you are ready to use the Workforce scripts. Delete assignments Caution: The following script will permanently delete assignments from your Workforce project. Be sure to create a backup of assignments before running this script. One way to create a backup of assignments is by running the copy_assignments_to_fs script, shown later in this blog. The delete_assignments script allows you to delete assignments based on a specific field within the assignments layer. Quickly delete assignments based on completion status, assigned worker, or any queried field using the following script: python delete_assignments.py -u username -p password -org "https://<org>.maps.arcgis.com" -project-id <project-id> -log-file "../log.txt" -where "1=1" Run this in the terminal or command prompt after editing the username, password, organization, and project-id to match your own credentials. Note: If you are working with a Classic project (a v1 project), the Project ID is the item ID of the project item. If you are working with projects enabled for offline use (a v2 project), the Project ID is the item ID of the Workforce feature service. Regardless of what version you are working with, the Project ID can be found in the URL of your project. For example, if the project URL is: https://workforce.arcgis.com/projects/a0f297f949f549f0ade07eer562d9934/configure/overview The project-id is: a0f297f949f549f0ade07eer562d9934 Edit the where clause to query for the assignments you want to delete. Here are a few examples that demonstrate how you can write the query when using this script: Someone left a company after completing hundreds of assignments during their tenure. The company queries their Worker ID and deletes all assignments they were assigned to. Query: -where “WorkerID=1” A snow plowing team has no reason to keep completed assignments. They query for completed assignments and delete them all. Query: -where “status=3" A landscaping company has completely changed their system of assigning work. They use the default where clause to delete all existing assignments. Query: -where “1=1” For more information on the values you can query for, see Overview of the Workforce Schema. For more information on this script, see the delete_assignments readme. Delete assignment types The delete_assignment_types script allows you to delete all assignment types within a project. This is useful if you have many assignment types that you need to change or replace. Instead of making a new Workforce project or manually removing assignment types one by one – use the following script to delete all assignment types at once: python delete_assignment_types.py -u username -p password -org "https://<org>.maps.arcgis.com" -project-id <project-id> -log-file "../log.txt" Run this in the terminal or command prompt after editing the username, password, organization, and project-id to match your own credentials. Note: The script will not run if any of the assignment types are in use. For example, a Workforce project contained 25 assignment types related to maintaining community parks. Park maintenance standards were updated, so the assignment types needed to be replaced. The delete_assignment_types script was used to delete all of the existing types at once to make room for the new assignment types. For more information on this script, see the delete_assignment_types readme. Copy assignments to a different feature layer The copy_assignments_to_fs script copies assignments from your assignments layer to a new feature layer. This script is useful for archiving assignments - allowing you to clean out your project without permanently deleting its assignment history. You’ll first need to identify or create the target feature layer you want to copy assignments to. Name it something meaningful. For example, if you’re copying assignments from a tree inspection project, name the target layer tree assignment copies or tree assignment archive. This script uses a JSON configuration file (shown below) to map the assignment layer field names to those in the target feature layer. The field names on the left belong to the assignments layer, and those on the right belong to the target feature layer. When creating the target feature layer, use different field names to distinguish them from the assignments layer. If you don’t want to edit the default configuration file, name your target fields “Original_” followed by the original field name (shown above). It’s important that you create a new OBJECTID and GLOBALID field in your target feature layer (named Original_OBJECTID and Original_GLOBALID, respectively). Since these are system generated fields, you may encounter duplicated values if you don’t create new fields. The Original_OBJECTID field should be an integer value, and the Original_GLOBALID field should be a string value. Note: If your target feature layer has different field names than those shown above, edit the configuration file to match your target field names. Then save the file. Once you have created your target feature layer and have edited the target field names in the configuration file, you are ready to run the script: python copy_assignments_to_fs.py -config-file "../sample_data/fieldMappings.json" -u username -p password -org "https://.maps.arcgis.com" -target-fl -where "1=1" -project-id -log-file "log.txt" --copy-attachments Be sure to edit the following: Provide the file path to the config-file Provide your username, password, and organization to connect to your content. Provide the complete feature service URL of the target feature layer (-target-fl). For example: "https://services.arcgis.com/<server>/arcgis/rest/services/AssignmentsArchives/FeatureServer/0" Use the where clause to query for the assignments you want to copy. The script defaults to copying all assignments (-where “1=1”). Provide the project-id of your Workforce project. Optionally, you can copy attachments (copy-attachments). Setting this parameter could slow down the script depending on how large your attachments are. Once you run this script, your assignments will be copied to the new feature layer. After you check to make sure this was successful, you can delete those assignments from your active Workforce project. For more information, see the copy_assignments_to_fs readme. Reset stale workers The reset_stale_workers script resets workers to the not working status if they haven’t changed their location, status, or contact information after a set date or time. If a worker forgets to update their status before taking a break or leaving for the day, they will still appear to be working on the dispatcher map. The following script keeps your project organized by resetting workers after a date or time that you set: python reset_stale_workers.py -u -p -org https://arcgis.com -project-id -cutoff-date -timezone "US/Eastern" Run this in the terminal or command prompt after editing the username, password, organization, and project-id to match your own credentials. The cutoff-date acts as the threshold for when workers should be reset. Input either a specific date or amount of time (in minutes) to satisfy this parameter. For example: A manager runs this script every Monday morning to make sure each worker begins the week with a status of not working. They run the script to reset workers who haven’t updated their status in the past 24 hours. Their cutoff-date input would be 1440 (the number of minutes in 24 hours). For more information, see the reset stale workers readme. Report incomplete assignments that have completed work orders The report_incomplete_assignments_with_work_orders script reports assignments that have a completed work order, yet have an assignment status of unassigned, assigned, or declined. This script gives you the option to cancel assignments that meet this condition. This allows you to clear your project of completed assignments that have an incorrect status in Workforce. Features in Collector and surveys in Survey123 can be integrated as work orders for Workforce assignments. To learn how to integrate Survey123 and Collector with your Workforce project, see Integrate other apps. In this example, there are four tree inspections that have been assigned to one mobile worker. The Workforce project is integrated with Survey123, so there is a survey (work order) associated with each assignment. While the worker completed three work orders, they only updated one assignment to have a status of completed, as shown in the table below. Work Order ID Workforce Assignment Status Survey123 Work Order 1 Assigned Completed 2 Assigned Completed 3 Completed Completed 4 Assigned Incomplete Run the following script to report the assignments that have completed work orders, but an incomplete status. The script will also cancel these assignments. python report_incomplete_assignments_with_work_orders.py -u username -p password -org https://arcgis.com -project-id -survey-id -field-name work_order_id --cancel-assignments Be sure to edit the following: Your username, password, and organization The project-id for the Workforce project The survey-id – this is the item ID for your survey layer The field-name you used to integrate your Workforce project with either Collector or Survey123. The script defaults to using the work_order_id. This is the field used in the example above. Add the optional --cancel-assignments parameter to cancel any assignments the script reports. After running the script, it reports the incomplete assignments with completed work orders. In the example above, the script returns assignments 1 and 2 and then cancels them both. For more information, see the report_incomplete_assignments readme. Note: There is also a script available that reports any assignment that have a status of “completed” yet don't have a completed work order. For more information, see the report_complete_assignments_without_work_orders readme. Additional resources This blog post taught you how to use ArcGIS API for Python to clean and maintain your Workforce projects. See the following blog posts to learn about other ways to automate tasks for Workforce: Automate Workforce with ArcGIS API for Python: Configure and Assign Automate Workforce with ArcGIS API for Python: Monitor Feel free to test out all of the Workforce scripts in the Github repo. To learn more about the Workforce module within the Python API, see Managing Workforce for ArcGIS Projects.
... View more
04-28-2020
06:33 AM
|
3
|
0
|
2918
|
BLOG
|
Welcome to another blog post that will teach you how to automate tasks for Workforce using ArcGIS API for Python. The last blog in this series was about using Python to set up and configure a Workforce project. We covered how to import workers, create assignments based off a feature layer, and assign work based on location. You can check it out here. This blog will teach you three different ways to monitor assignments using ArcGIS API for Python. It can be overwhelming to keep up with all of the assignments within your project, especially when you have multiple workers. The following scripts are designed to help you monitor work efficiently. You’ll learn how to create a dashboard for your project using ArcGIS Dashboards, how to monitor the status of assignments using Slack, and how to verify a worker’s location at the time they modified an assignment. Overview Scenario Download Workforce scripts Install ArcGIS API for Python Create a dashboard Monitor assignments with Slack Check assignment completion location Additional resources Scenario A tree inspection company is using Workforce to assign inspections to workers, and there are 24 open assignments throughout the city of Atlanta. You, as the inspection lead, want an easy way to monitor the progress of these assignments. Note: This scenario uses the project created in the first blog; however, you can use any Workforce project that you own to follow along with these exercises. Download Workforce scripts First, clone or download the workforce-scripts GitHub repository This contains the Python scripts for Workforce as well as the version of the Python API needed to automate Workforce projects. Once it's downloaded, navigate to the “workforce-scripts” folder in either the terminal or the command prompt. A Windows operating system is used for this example. cd C:\Users\user\Desktop\workforce-scripts Install ArcGIS API for Python To automate and script Workforce projects, you must use ArcGIS API for Python 1.8.3 or later. Version 1.8.3 is included in workforce-scripts file. Run the following command in either a Python script or Python console to create the virtual environment with the correct dependencies and to install ArcGIS API for Python 1.8.3: conda env create --file environment.yml Next, activate the environment: conda activate workforce-scripts Once you've created and activated the environment, you are ready to use the Workforce scripts. Create a dashboard Note: The following section describes how to create a dashboard for Classic projects. To learn how to automate the creation of a dashboard for a project that is offline enabled and supported in ArcGIS Workforce, see Monitor assignment status in ArcGIS Dashboards using a joined Workforce layer. ArcGIS Dashboards is a web application that allows you to monitor your operations in real-time. While the Workforce web app allows dispatchers to edit and view assignments, a dashboard provides a read-only alternative for supervisors and users. A dashboard displays key statistics, allowing you to understand the progress of your project at a glance. You can create a dashboard for your Workforce project with just one command. Have the following information ready to use as parameters for the script: Username Password Organization URL (<org>.maps.arcgis.com) Project ID Note: If you are working with a Classic project (a v1 project), the Project ID is the item ID of the project item. If you are working with projects enabled for offline use (a v2 project), the Project ID is the item ID of the Workforce feature service. Regardless of what version you are working with, the Project ID can be found in the URL of your project. For example, if the project URL is: https://workforce.arcgis.com/projects/a0f297f949f549f0ade07eer562d9934/configure/overview The project-id is: a0f297f949f549f0ade07eer562d9934 For a complete list of parameters, see the readme for this script. Run create_ops_dasbhoard.py in either the terminal or command prompt. Be sure to swap the default parameters with your own. python create_ops_dashboard.py -u <username> -p <password> -org https://arcgis.com -project-id <project_id> --light-mode Once you run this script, you’ll see a new dashboard has been shared with the group containing your Workforce project. Here’s what the dashboard for the Tree Inspections project looks like: The script creates a dashboard that shows worker information, assignment information, and a copy of the Dispatcher map. The dashboard will update to reflect changes in assignment completion and worker status in real time. This is great to have displayed in the office to quickly note the progress of your operation. Monitor assignments with Slack Slack is an office communication tool that allows employees to stay connected with one another during the workday. By adding a webhook to a channel on Slack, you can receive information and updates from outside web sources, including Workforce. The assignment monitor script connects your Workforce project with a webhook so that you will receive a message in Slack every time an assignment is completed. Anyone who joins the Slack channel that contains the webhook will receive these notifications. Tip: This script can also be configured to send notifications to your email account. See the assignment_monitor readme for more information. To add a webhook to a Slack channel, you’ll first need to create a new app in Slack. Visit the Your Apps page in the Slack API and click Create New App. Give your app an appropriate title. This one is called “Tree Inspections”. You’ll also need to select the Slack Workspace you want your app to belong to. Once your app is created, you can create a webhook. Go to the Basic Information page for your app and click Incoming Webhooks. Make sure that Activate Incoming Webhooks is toggled on. Then click Add new Webhook to Workspace. Note: If you aren’t the manager for your workspace, you will need to request permission to add a webhook. A window appears requesting permission for the app to access your workspace. Select the channel you want your app to post to and click Allow. Tip: Since this webhook will send a message every time an assignment is completed, you may want to create a channel specifically for it. You have successfully created a new web hook. Copy the Webhook URL, shown below, and paste it somewhere you can easily access. You will need it for running the Python script. If you go to the Slack channel you connected the webhook to, there will be a message saying a new app was integrated. Now that you have created a Slack webhook and connected it to your workspace, you are ready to run the Python script. First, in the Assignment Monitor folder, edit the config file. Edit the file to include your project ID, slack webhook URL, organization, and log-in credentials. Once you’re done editing the file, save it. You are now ready to run the Python script. Open the terminal or command prompt and make sure your file path points to the scripts folder: cd C:\Users\user\Desktop\workforce-scripts\scripts Then run the assignment monitor script: python assignment_monitor.py The script will check for newly completed assignments, and a message will be sent to your assignment monitor channel on Slack when one is found. To test this, log in as one of your workers on the Workforce mobile app and complete an assignment. A message will appear in Slack that looks like this: This message shows who completed what assignment and where it is located. It also shows that the worker left a note saying the assignment needs attention right away. The script will continue checking for completed assignments every 5 seconds. To stop the script, press Ctrl+c while in the terminal or command prompt. Tip: This script can be modified to run once as opposed to looping infinitely. It can be called every so often (i.e. once per minute) using a task scheduler such as Windows Task Scheduler or Cron. For more information, see the assignment_monitor readme. Check completion location The check_edit_location script uses data from Tracker for ArcGIS to see if a worker edited a feature without visiting its location. Assignments in Workforce, features in Collector, and surveys in Survey123 can all be checked using this script. If you want to follow along with this exercise, find a Workforce project that has workers who have enabled location tracking. Note: Location Tracking must be enabled for your organization to use this script. You must either be an administrator or a track viewer who can view the tracks of each worker whose work you'd like to verify. For example, Sharon, a tree inspector, completed three assignments this morning (shown below). The check_edit_location script is used to verify that Sharon visited the location of each completed assignment. First, clone or download the Github repository that contains the Python scripts for Tracker. Next, open the terminal or command prompt and navigate to the scripts folder: cd C:\Users\user\Desktop\tracker-scripts\scripts Create the virtual environment with the correct dependencies: conda env create --file environment.yml Activate the environment: conda activate tracker-scripts Here is the check_edit_location script: python check_edit_location.py -u username -p password -org https://arcgis.com -workers <worker1>, <worker2> -field-name completedDate -time-tolerance 10 -distance-tolerance 100 -layer-url <layer-url> -tracks-layer-url <tracks-layer-url> Before you run it, you will want to make sure you edit the parameters as follows: Provide your username, password, and AGOL organization to connect to your content. List the username for each worker whose assignment and location you want to check. Set the field name to the date field within the feature layer you want to verify. To check for assignment completion, use completedDate as input for this parameter. Set a time tolerance that provides a range around the time when the assignment was completed. The script defaults to 10 minutes. Set a distance tolerance that provides a buffer around the location where the assignment was completed. The script defaults to 100 meters. Set the minimum accuracy required when querying worker locations. The script defaults to 50 meters. Provide the complete feature service URL for the assignments layer. For example: https://services.arcgis.com/a910db6b36ff4066a9d4131fccc3da9b/arcgis/rest/services/assignments_ad9af2fc00314fa49ce79ec7d7317acc/FeatureServer/0 Enter the complete tracks layer URL if there is a specific track view you want to utilize. The script defaults to the tracks layer in your location tracking service. For example: https://locationservicesdev.arcgis.com/US6xjA1Nd8bW1aoAarcgis/rest/services/5bfd7a01b6d4b698df17af205b8dbef_Track_View/FeatureServer/0 Once the parameters are set, run the script. For this example, the script was run with the default parameters to see if Sharon was within 100 meters of the tree inspection assignments at the time they were completed. The script returned the following message: The user sharon_user who last edited the feature with OBJECTID 22 was potentially not within the distance tolerance when updating the field completedDate The script only returns assignments that are invalid. This means that Sharon did visit the location of two of the assignments she completed. However, there is one tree inspection that she may not have visited. Next, Sharon’s tracks were added to the assignments layer to see if the script’s output made sense. Sharon’s tracks, shown in pink above, show that she visited assignments 21 and 20, but did not visit assignment 22. The script successfully reported that, though assignment 22 was completed, Sharon potentially did not visit the site of the tree inspection. For more information about this script, see the check_edit_location readme. Additional resources This blog post taught you how to use ArcGIS API for Python to monitor your Workforce projects. See the following blog posts to learn about other ways to automate tasks for Workforce: Automate Workforce with ArcGIS API for Python: Configure and Assign Automate Workforce with ArcGIS API for Python: Clean and Maintain Feel free to test out all of the Workforce scripts in the Github repo. To learn more about the Workforce module within the Python API, see Managing Workforce for ArcGIS Projects.
... View more
03-31-2020
07:29 AM
|
3
|
0
|
3644
|
BLOG
|
Welcome to the first in a series of blog posts that will teach you how to automate key workflows for Workforce for ArcGIS. The Workforce module within ArcGIS API for Python makes managing Workforce projects a simple and efficient task. We are constantly creating new scripts that simplify app-based workflows into just a few lines of code. Whether you are setting up your first Workforce project, cleaning out a project with hundreds of old assignments, or trying to find new ways to improve your organization’s efficiency – the Python API will be a powerful addition to your geospatial arsenal. This first blog is a step-by-step tutorial that will teach you how to configure a Workforce project and create assignments. Overview Getting started Scenario Download Workforce Scripts Install ArcGIS API for Python Import workers from a CSV file Add assignment types Create assignments based on an existing feature layer Assign work based on location Additional resources Getting started If you would like to complete each task alongside this exercise, first do the following: Review the requirements for installing ArcGIS API for Python Download the attached Jupyter Notebook - tree_inspections.ipynb Download the attached CSV file - tree_inspectors.csv Create a blank Workforce project Note: If you don't have an ArcGIS account, you can sign up for a free trial. Scenario In this scenario, the city of Atlanta has identified 24 trees that are at risk of falling. These trees are in heavily developed areas, so it’s crucial that they be professionally inspected. The city has hired a tree risk assessment company to perform these inspections. You will use ArcGIS API for Python to configure a Workforce project for the company. You will import the company’s workers, create assignments based on a feature layer containing the trees, and assign inspections to workers based on the zone that each worker oversees. Download Workforce scripts First, clone or download the workforce-scripts GitHub repository This contains the Python scripts for Workforce as well as the version of the Python API needed to automate Workforce projects. Once it's downloaded, navigate to the “workforce-scripts” folder in either the terminal or the command prompt. A Windows operating system is used for this example. cd C:\Users\user\Desktop\workforce-scripts Install ArcGIS API for Python Run the following command in either a Python script or Python console to create the virtual environment with the correct dependencies and to install ArcGIS API for Python 1.8.3: conda env create --file environment.yml Note: To automate Workforce projects, you must use ArcGIS API for Python 1.8.3 or later. Next, activate the environment: conda activate workforce-scripts Once you've created and activated the environment, you are ready to use the Workforce scripts. Import workers from a CSV The import_workers Python script allows you to import workers directly from a CSV file. This script is especially useful for importing a large number of workers into a project. Rather than input your workers one by one in the Workforce app, you can run this single line of code instead. We will use the import_workers script to import a CSV file of tree inspectors into this scenario's Workforce project. This is the CSV file that you downloaded earlier: There are 5 tree inspectors that will be imported into the project. Their name, working status, title, contact number, and user ID will all be passed through the script. Open this file and edit the name and userID columns with the information of at least four workers within your organization. Save your changes. Note: This script has many options allowing the user to specify the names of each column within the CSV. Check out the import_workers readme for more information. In the terminal or command prompt, run the import workers script: python import_workers.py -u <username> -p <password> -org https://<org>.maps.arcgis.com -name-field name -status-field status -user-id-field userId -log-file log.txt -csv-file ../sample_data/tree_inspectors.csv -project-id <project id> -title-field title -contact-number-field contactNumber Make sure you update the following fields with your own information: Username and password Organization CSV file Project ID (from the blank project you created) Note: If you are working with a Classic project (a v1 project), the Project ID is the item ID of the project item. If you are working with projects enabled for offline use (a v2 project), the Project ID is the item ID of the Workforce feature service. Regardless of what version you are working with, the Project ID can be found in the URL of your project. For example, if the project URL is: https://workforce.arcgis.com/projects/a0f297f949f549f0ade07eer562d9934/configure/overview The project-id is: a0f297f949f549f0ade07eer562d9934 Once this script has been run, check that your tree inspectors have been successfully added to your project (shown below). Add assignment types Note: We will be using Jupyter notebooks to complete the remaining tasks within this workflow. Notebooks are useful for visualizing data and running code step by step. Either open a blank Jupyter Notebook or follow along with the notebook you downloaded earlier. First, import the ArcGIS API for Python library. Next, connect to your GIS and fetch the project using its feature service item ID or project ID. Once this set-up is complete, you can start performing tasks specific to your project. You’ll first want to add assignment types to the project that are relevant to tree inspections. After you run this code, you can check that the assignment types have been successfully added to the project (shown below). Create assignments based on an existing feature layer The city of Atlanta has provided a feature layer containing the trees that are at risk of falling. Using the Python API, you can create an inspection assignment for each feature within this layer. First, import the datetime library. Datetime allows us to pass the current time into the assigned date field. Then you can fetch the layer containing the trees, query it, and display it on a map. Workforce stores assignments in the WGS84 Web Mercator projected coordinate system, so let’s ensure that the returned geometries are using this spatial reference. Here is the item ID for the trees feature layer: 88495d3b613a41f4a70b9d61ef979b34 The Atlanta Trees layer is displayed. Now you will create 24 “Inspect tree” assignments: one for each tree. You will loop through the trees feature layer to batch add assignments using the “Inspect tree” type we created in the previous section. To ensure that a new assignment was created for each tree, display the assignments layer on a map. Your project now has 24 tree inspection assignments. Assign work based on location You have your tree inspectors and your assignments. Now it’s time to assign work. You will assign the inspections to four workers. Each inspector oversees a specific work zone in Atlanta, so they will only inspect trees that fall within their respective zone. You will use the work zone feature layer to assign each of the 24 tree inspections to a set of four zones. We’ll import some modules from within the arcgis library to make typing these classes easier. Next, let’s get the Inspection Zones feature layer and display it on a map. Here is the item ID for the Inspection Zones feature layer: ac044c7a2c94401eaeb1b215200feb57 Add your assignments layer to the map so you can visualize how the assignments are distributed within the zones. Next, you’ll create a spatially enabled data frame from the zones layer and grab all of the unassigned assignments. Assign tree inspections to workers within each of their respective zones. Trees in Zone 1 should be assigned to Josh Trees in Zone 2 should be assigned to Jane Trees in Zone 3 should be assigned to Nirav Trees in Zone 4 should be assigned to Sharon The following code will assign each worker to the trees that fall within the work zone they are responsible for. Run this code and then create a map with the updated assignments layer to make sure everything was assigned properly. If you click on any of the features, the status should read “Assigned”. Now, if you open your Workforce project, you can view all of your updated assignments. If you sort by assignee, you’ll see that inspectors were only assigned to work for their specific zone. You’ll see that only inspections in Zone 2 were assigned to Jane. You have successfully set up a Workforce project and assigned work using ArcGIS API for Python! Additional resources This blog post taught you how to use ArcGIS API for Python to configure your Workforce projects and assign work. See the following blog posts to learn about other ways to automate tasks for Workforce: Automate Workforce with ArcGIS API for Python: Monitor Automate Workforce with ArcGIS API for Python: Clean and Maintain Feel free to test out all of the Workforce scripts in the Github repo. To learn more about the Workforce module within the Python API, see Managing Workforce for ArcGIS Projects.
... View more
03-10-2020
11:26 AM
|
6
|
2
|
6313
|
Title | Kudos | Posted |
---|---|---|
4 | a week ago | |
2 | 10-30-2023 07:33 AM | |
5 | 08-08-2023 06:00 AM | |
5 | 05-01-2023 12:24 PM | |
3 | 04-28-2020 06:33 AM |
Online Status |
Offline
|
Date Last Visited |
Tuesday
|