POST
|
I've seen a couple of great answers to similar questions that I hope to use to get me started. My questions might be a bit more complicated. I have survey report data that includes a "year" field. My current map is a series of tabs and each tab contains it's own shortlist map that displays these reports by their specific year. We would like to try and combine the data into one shortlist map and display the reports all together, but with different colored markers for different years. They don't need to be fancy, maybe just a banner icon with different colors. So I'm envisioning some sort of logical function in MainView.js (?) that would look to see what year is listed in the record and display an appropriate icon. I'm not the best at coding so I was hoping to find somebody that could provide some form of simplified template or some guidance towards making my code for this purpose. Any additional resources would be great. Thanks!
... View more
04-23-2021
09:06 AM
|
0
|
0
|
297
|
POST
|
Sorry, It pastes without indentation so I went back in and edited it. Yes, the path was a full file path. I used the calculate field tool in ArcGIS Pro. Original input to the calculate field tool looks like this: Expression: DESC5=Reclass(!advisory_lvl!) Code Block: def Reclass(advisory_lvl): if (advisory_lvl == "Caution"): return '<a href="path"><img src="path" style="width: 150px;"></a>' elif (advisory_lvl == "Closure"): return '<a href="path"><img src="path" style="width: 150px;"></a>'
... View more
06-23-2020
03:10 PM
|
0
|
0
|
1097
|
POST
|
Full python code created by ArcGIS Pro. # scheduled task: HABS_DESC5 import datetime, arcpy from xml.sax.saxutils import escape taskname = "HABS_DESC5" ret = None ticks = int((datetime.datetime.utcnow() - datetime.datetime(1, 1, 1)).total_seconds() * 10**7) try: arcpy.env.overwriteOutput = True project = arcpy.mp.ArcGISProject(r'path.aprx') active_map = next((it for it in project.listMaps() if it.getDefinition('v2').uRI == 'CIMPATH=map1/map1.xml'), None) if active_map: with active_map._arc_object: ret = arcpy.management.CalculateField(r"Harmful Algal Bloom Report 3\surveyPoint", "DESC5", "Reclass(!advisory_lvl!)", "PYTHON3", @"def Reclass(advisory_lvl): if (advisory_lvl == ""CAUTION""): return '<a href=""path"" style=""width: 150px;""></a>' elif (advisory_lvl == ""CLOSURE""): return '<a href=""path"" style=""width: 150px;""></a>' ", "TEXT") else: ret = arcpy.management.CalculateField(r"Harmful Algal Bloom Report 3\surveyPoint", "DESC5", "Reclass(!advisory_lvl!)", "PYTHON3", @"def Reclass(advisory_lvl): if (advisory_lvl == ""CAUTION""): return '<a href=""path"" style=""width: 150px;""></a>' elif (advisory_lvl == ""CLOSURE""): return '<a href=""path"" style=""width: 150px;""></a>' ", "TEXT") except: pass finally: ticks2 = int((datetime.datetime.utcnow() - datetime.datetime(1, 1, 1)).total_seconds() * 10**7) status = 0 if ret is None else ret.status if type (ret) == arcpy.Result else 4 xml = f'<log status="{status}" start="{ticks}" end="{ticks2}" taskname="{escape(taskname)}">' xml += '<messages>' try: xml += ''.join([f'<msg code="{msg[0]}" type="{msg[1]}">{escape(msg[2])}</msg>' for msg in arcpy.gp.GetAllMessages()]) except: pass xml += '</messages></log>' log_file = r"path.log".format('%x' % ticks) with open(log_file, 'w', encoding='utf-8') as file: file.write(xml)
... View more
06-23-2020
02:53 PM
|
0
|
2
|
1097
|
POST
|
Ok, so new focus on this same topic. ArcGIS Pro generates it's own python script to run in windows task scheduler. When I try to run that same script in the command line I get the following syntax error. Can anyone tell me what this is about? The up arrow is supposed to be pointing at the @ symbol. At least that's how it is displayed in the cmd window. path\task.py File "path\task.py", line 17 ret = arcpy.management.CalculateField(r"Harmful Algal Bloom Report 3\surveyPoint", "DESC5", "Reclass(!advisory_lvl!)", "PYTHON3", @"def Reclass(advisory_lvl): ^ SyntaxError: invalid syntax
... View more
06-23-2020
12:16 PM
|
0
|
4
|
1097
|
POST
|
I've tried most of the ideas I can find online and nothing. Anyone else got anything?
... View more
06-23-2020
09:45 AM
|
0
|
0
|
1097
|
POST
|
Windows 10 Enterprise w/ ArcGIS Pro 2.5.1 and Python 3. I have managed to schedule a field concatenation process on the same feature layer that is currently working on a schedule and that process works just fine. For some reason, the following process will execute and create the data I want when I use the calculate field tool, but when I try to schedule it, the arc pro scheduler won't run it at all. There is no error apparent or log file created. I am not an experienced python programmer and have a very rudimentary idea of how this works. I put this together using examples. I have "copied" the python command that the tool generates below. Hopefully this can help. I want the script to look and see if the field "advisory_lvl" contains text of "CAUTION" or "CLOSURE" and write the field DESC5 with the appropriate image URL. As I said, this process works perfectly when I initiate it manually using the calculate field tool so I don't really know what's wrong with scheduling it. This does not work with the Pro scheduler tool: arcpy.management.CalculateField(r"Harmful Algal Bloom Report 3\surveyPoint", "DESC5", "Reclass(!advisory_lvl!)", "PYTHON3", @"def Reclass(advisory_lvl): if (advisory_lvl == ""CAUTION""): return '<a href=""url""><img src=""url"" style=""width: 150px;""></a>' elif (advisory_lvl == ""CLOSURE""): return '<a href=""url""><img src=""url"" style=""width: 150px;""></a>' ", "TEXT") This works with the Pro scheduler tool: arcpy.management.CalculateField(r"Harmful Algal Bloom Report 3\surveyPoint", "DESC4", "'<b>Agency:</b>' + ' ' + str(!agency!) + '<br>' + '<b>Sample Date:</b>' + ' ' + str(!sample_date!) + '<br>' + '<b>Advisory Level:</b>' + ' ' + str(!advisory_lvl!) + '<br>' + '<b>Advisory Issued:</b>' + ' ' + str(!advisory_issued!) + '<br>' + '<b>Advisory Lifted:</b>' + ' ' + str(!advisory_lifted!) + '<br>' + '<b>Cyanobacteria Density:</b>' + ' ' + str(!cyano_density!) + '<br>' + '<b>Microcystin:</b>' + ' ' + str(!microcystin!) + '<br>' + '<b>Anatoxin:</b>' + ' ' + str(!anatoxin!) ", "PYTHON3", '', "TEXT") Please let me know if there is any other information I can provide. Thanks for your help! Update: ArcPro scheduler creates a task within windows task scheduler. The last run result returns (0x1). Looking at the general history panel it runs pythonw.exe with return code 2147942401. This is apparently some form of "illegal function". No idea what or why, especially since other scripts run just fine. I did try running the script "run only when user is logged on" and that doesn't seem to affect anything.
... View more
06-19-2020
02:23 PM
|
0
|
6
|
1172
|
POST
|
Not sure how to adjust the size of the logo, if it's even possible. No, I can't host it myself or I would. I had to merge three agency logo's into one graphic. I would like the entire thing to be a little larger for readability. Also interested in customized banners if that's possible using assistant. Thanks! "header": { "linkText": "", "linkURL": "", "logoURL": "https://www.arcgis.com/sharing/rest/content/items/e8ac7302f8cd4d778461d422492a9d7f/resources/sm_series_logo__1592233456490.jpg", "logoTarget": "", "social": { "facebook": false, "twitter": false, "bitly": false }, "compactSize": true
... View more
06-15-2020
09:50 AM
|
0
|
0
|
321
|
POST
|
Hello Jake, Thanks for the advice. I'm definitely investigating ArcPro, however, I don't have it at the moment and my computer doesn't pass the scan for minimum system requirements. So that may take some work. Myself and a number of colleagues are scheduled to take the migration class next month. Maybe that will help. I'm collecting public reports using survey123 and trying to integrate those into a shortlist story map. One of the problems I'm trying to solve is that the shortlist templates only take 5 description fields. The information I want to display is more like 8 individual lines. So I've tried to concatenate fields to one or two description fields with line breaks or carriage returns. So far I have not been able to get any of that to work. Survey123 seems to have the ability to create a auto-calculate field in the xls form, but it doesn't seem to recognize anything I do to create a new line. ArcOnline has a calculation field and seems to concatenate fine, but that must be run manually each time I want to update and I would like it to update at least once per day, if not more often. I'm trying to make all of this hands off as much as possible. Hopefully that helps narrow down the issues a bit? I've seen that other people seem to be able to accomplish this so I'm not sure if I'm missing something easy or if there is some technique I'm not aware of or maybe they are just spending a lot more man hours updating fields.
... View more
04-22-2020
08:57 AM
|
0
|
0
|
404
|
POST
|
Python newb here. I know just enough to make trouble for everyone else. Does anyone have a python script that I can steal that will cycle through all available records of an online feature service and concatenate three or four fields into one string field each time the script runs? I'm trying to update a field and don't want to run a calculation multiple times a day. Thanks for code or ideas! PS. I'm already using the DetectEdits script. If you are familiar and think it would be possible to add code to this script then maybe that would be more efficient. Ismael Chivite Jake Skinner
... View more
04-21-2020
03:20 PM
|
0
|
2
|
445
|
POST
|
Are there any updates to this issue? I'm not sure it's exactly related but I see the original poster using \n for a line break. I've been trying to use that in my calculation field and it doesn't seem to be working. Thanks!
... View more
04-20-2020
03:49 PM
|
1
|
0
|
3095
|
POST
|
Thanks Jake. Adding the index layer helped. The tool worked just fine. I login to arcgis through an enterprise login. So far I’m just sharing the layer public and then running this script when I want. However, I want to eventually make it an automated process through windows task scheduler. Is there a way to go about the login process with your script and can you recommend a guidance to get that script running? I’m also wondering if it’s not to hard to use the same script to run a calculated field so it also updates. Thanks for the help! Erik
... View more
04-15-2020
12:39 PM
|
0
|
1
|
515
|
POST
|
I am trying to build a shortlist story map and running into some problems I'm trying to work around. Hopefully this all makes sense to somebody. I want my maps to be dynamically populated based on data received from public surveys through survey123. These surveys have the option to include pictures that are apparently stored as attachments and are not part of the normal table. So in order for the shortlist to recognize the pictures then I have to either manually move the pictures over to a specific picture field, or use something like the convert attachments tool. I want the map to stay as updated as possible so I would like to eventually have windows task scheduler run some python scripts to update this data once or twice a day. I'm not good with python, but I've managed to get the tool box loaded into arcmap and can run the tool from there. Any help with explaining how to run this tool from windows task scheduler would be great as well. I've tried running it outside of arcmap in command prompts and python command line, but no luck so far. If you also happen to know of any good guidance on how to adapt the python script to perform other updates, such as run a calculated field, then that would also be useful. Unfortunately, I keep getting various errors when I try to run the tool. Sometimes I get token errors, which I don't understand. Often times I get errors saying I don't have attachments, but I think I do. So anyways, looking for somebody that can help me trouble shoot this thing please. My last error message. Executing: AttachmentstoPopup false true false # # # https://services3.arcgis.com/juqcZ3KnfEqg8N1S/arcgis/rest/services/survey123_22525a308de24da4b7d963e5a7cd8b90/FeatureServer PIC_URL Start Time: Tue Apr 14 09:00:16 2020 Running script AttachmentstoPopup... Feature service does not contain attachments Completed script AttachmentstoPopup... Failed to execute (AttachmentstoPopup). Failed at Tue Apr 14 09:00:17 2020 (Elapsed Time: 0.98 seconds) Thanks for any ideas! Erik Leigh Jake Skinner
... View more
04-14-2020
10:30 AM
|
0
|
3
|
570
|
BLOG
|
Actually the system is blocking the connection to the email servers when trying to setup the flow. I probably just need to get help from IT. REST API is not yet supported for this mailbox. This error can occur for sandbox (test) accounts or for accounts that are on a dedicated (on-premise) mail server.
... View more
11-26-2019
11:03 AM
|
0
|
0
|
5659
|
BLOG
|
Thanks Mikaila, I can access flow, but our system blocks the database connections required to enable the webhook.
... View more
11-26-2019
10:49 AM
|
0
|
0
|
5659
|
POST
|
We don't have a server. I'm looking for the best way to create an online map that is dynamically connected to a database so it will provide constant updates on information without having to republish. Is it possible to publish a query layer and maintain that database connection? Are there any other options? Thanks!
... View more
11-26-2019
09:28 AM
|
0
|
1
|
324
|
Title | Kudos | Posted |
---|---|---|
1 | 03-17-2017 07:57 AM | |
1 | 04-20-2020 03:49 PM |
Online Status |
Offline
|
Date Last Visited |
05-06-2021
05:13 PM
|