|
POST
|
No worries! I did a little playing because I was curious and it also seems quite important for you (COVID and all). If in AGOL content you go Create->Feature Layer->From URL and put in the url to the JHU service, it should create an exact replica but empty. Then I've written a little script using the ArcGIS API for Python that should update the data for you as long as the schemas match; if you have access to either ArcGIS Notebooks or ArcGIS Pro then the following should work to update the data for you: from arcgis.gis import GIS
#gis = GIS("home") uncomment this if you run it from notebook in AGOL
#gis = GIS("pro")uncomment this if running from pro
id1 = "" #AGOL ItemID of JHU service item
id2 = "" #AGOL ItemID of your replica service
item1 = gis.content.get(id1)
item2 = gis.content.get(id2)
flayer1 = item1.layers[0] # assuming there is only one layer in the service?
flayer2 = item2.layers[0]
print("Querying JHU feature service")
fset = flayer1.query(where="1=1", out_fields="*", return_all_records=True)
print("{} features returned".format(len(fset.features))
print("Deleting features in replica JHU service")
flayer2.delete_features(where="1=1") # clearing out previous data
print("Adding features to replica JHU service")
flayer2.edit_features(adds=fset) # adding new data This is very rudimentary and also not the most sensible way to solve it, as I'm nuking and appending all data instead of just taking changes from the last day etc., but it should do the trick.
... View more
07-28-2020
10:24 AM
|
1
|
2
|
4507
|
|
POST
|
I don't think that is possible, and you are right - it does specify that you have to own both of the items to run this tool. In which case I would imagine creating a hosted feature with the same schema as JHU, and then have either an automated or manual process for updating your hosted feature service, may be the best solution. I can't really see any better way of achieving what you're hoping to achieve!
... View more
07-28-2020
06:40 AM
|
0
|
4
|
4507
|
|
POST
|
Hi Anna, Have you looked into the "Join Features" analysis tool in ArcGIS Online? Join Features—ArcGIS Online Help | Documentation I believe it makes a view layer joining two hosted feature services, and if you create the join based on a shared attribute (instead of a spatial join) then it will automatically update as changes are made to the two underlying services. Create results as hosted feature layer view allows the data to stay up to date as the source data changes. Hosted feature layer views containing joins will be read-only and do not consume credits for analysis and storage. If statistics are included as part of the output, the hosted feature layer view will contain an extra table layer in the view with the statistics. Attachments on the target layer will be preserved if the target layer has attachments enabled and a GlobalID field. For more information on hosted feature layer views, see Limitations. Might very well be the best solution in this case.
... View more
07-28-2020
06:23 AM
|
0
|
6
|
4507
|
|
POST
|
Hi Bert, You can simply add the line "return $feature.verharding" to the else clause, which means for all other values it will just return the existing value. Note, a better way to do this would be to use the IIF arcade function detailed here: Logical Functions | ArcGIS for Developers to do it in one line!
... View more
07-28-2020
01:24 AM
|
3
|
0
|
16693
|
|
POST
|
Hi, When configuring the script parameter, did you check the box for "Multiple values"? When you do so it returns a list, which is what the function in that metadata script requires as an input (as it is using the input in a for loop). The error message you're getting is a generic Python error which occurs when trying to loop over something that can't be looped.
... View more
07-24-2020
07:50 AM
|
0
|
0
|
1465
|
|
POST
|
Easy then! from arcgis.gis import GIS
from arcgis.mapping import WebMap
gis = GIS('pro')# if running this from Notebook for ArcGIS in AGOL/Enterprise, replace this line with gis = GIS('home')
wmItemId = "" #put the id of the webmap in here
wmItem = gis.content.get(wmItemId)
wm = WebMap(wmItem)
for lyr in wm.layers:
print(lyr.title) I wrote that to be run from the Python window in Pro, but see my note in line 3 about using it in ArcGIS Notebook. Just put the ID of the web map item into line 4 and it should print out all the layers for the given webmap.
... View more
07-09-2020
08:04 AM
|
5
|
11
|
5127
|
|
POST
|
Do you have access to ArcGIS Pro or ArcGIS Notebook (in AGOL or enterprise)? If so this can be done using the ArcGIS API for Python pretty easily!
... View more
07-09-2020
07:53 AM
|
1
|
13
|
5127
|
|
POST
|
I realise that should be "NADR_GID" not "NADR_ID", where are you putting that line of code? It should be in the box below the code block, and the code block should be empty! If that fails, I'd be happy to take another look at the error message it gives. Also I realised in your previous screenshot it's running as Python9.3, try the above line or my original solution with "Python" as the expression type just in case!
... View more
07-09-2020
04:45 AM
|
0
|
0
|
1012
|
|
POST
|
That really should run fine, I don't see how that's giving a syntax error, unless it doesn't like the indentation. In any case I defer to Dan's solution which is running the same thing but in one line: !NADR_ID! if !NADR_ID! in !ABOVE! else None
... View more
07-09-2020
03:51 AM
|
0
|
2
|
1012
|
|
POST
|
Can you post another picture of what you ran this time?
... View more
07-09-2020
03:13 AM
|
0
|
4
|
3046
|
|
POST
|
So in the original code I sent through, leave the field1 and field2 as they are (don't replace with your fields)! When you run myfunct(!NADR_GID!, !ABOVE!) that's substituting those values in there.
... View more
07-09-2020
02:55 AM
|
0
|
6
|
3046
|
|
POST
|
This shouldn't be an issue from my understanding, the multiple numbers in the second column are all just strings joined by ";"s, so if the number from the first column is anywhere in the second column it will return it. Have you tried running it? If so maybe you can show me where it has returned a value that you didn't want?
... View more
07-09-2020
02:21 AM
|
0
|
8
|
3046
|
|
POST
|
Hi Kristyna, I've done something quite similar to this in the past! In this case you don't actually need to use cursors, just the field calculator using Python will do! If you right click on the third field (BELOW) and go to "calculate field", select "python" for the expression type, put the following code in the code block: def myfunc(field1, field2):
if str(field1) in field2:
return field1
else:
return None Then in the box above the codeblock, put the following line my_func(!NADR_GID!, !ABOVE!) It should do exactly what you're hoping for it to do. Basically taking the first number, converting it to a string, looking for that sequence in the second field, then returning the first field's value if there is a match!
... View more
07-09-2020
01:54 AM
|
0
|
11
|
3046
|
|
POST
|
Parfait! I should have added an if statement to check whether that category is in the dictionary anyway, see line 3 below. with arcpy.da.UpdateCursor(fc, fields) as cursor:
for row in cursor:
if row[1] in description_dict:
row[0] = description_dict[row[1]]
cursor.updateRow(row) Then it should just skip over those values!
... View more
07-08-2020
01:38 PM
|
1
|
0
|
4028
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-22-2023 10:37 PM | |
| 1 | 04-05-2023 11:09 PM | |
| 1 | 05-21-2024 10:26 PM | |
| 1 | 04-20-2023 12:05 AM | |
| 1 | 05-21-2023 10:47 PM |
| Online Status |
Offline
|
| Date Last Visited |
03-20-2025
08:52 AM
|