POST
|
Hi all. So, working with a co-worker, we solved the issue. For our top level classic story map, we have it shared to our Organization and some Groups, but is not shared publicly. When adding a new tab into the classic story map, a dialogue appears (see below) that gives some configurable options. I added a tab and used the 'Web Link' option to add the URL of my ArcGIS Story Map to the classic story map. What we discovered is that we had to disable the 'Allow members of other organizations to access this content' option. That allowed the embedded Story Map to display. Hope that helps anyone in the future.
... View more
09-01-2021
08:14 AM
|
1
|
0
|
1057
|
POST
|
Thanks everyone. I did some more sleuthing and tried a range of troubleshooting. Finally I called ESRI Support and we walked through my script and discovered that I was using the wrong Item ID. When you publish a zipped file geodatabase as a hosted feature layer, 2 items are created. The hosted feature service and the underlying geodatabase. See below: On the line from my script above, i.e.: pwr = gis.content.get('cf755f973b4a4f19a0e2e80425d30188') I was using the item id from the 'Feature Layer (Hosted)' service layer, where I should have been using the item id from the File Geodatabase item. My script works once again. Hope that helps those who run into the same issue.
... View more
08-26-2021
04:30 PM
|
0
|
0
|
959
|
POST
|
Hello, I have a tabbed theme Story Map we created from the Classic Story map app. We have created additional story maps in the classic version of the app so that we can create 'sub tabs' within the parent story map so that it looks like this: So, as you click through all the top level tabs, each one will show some second or third tier tabs that were created by embedding additional story maps to create the tiered tab experience. To do this, I simply click on the 'Edit' button in the top right corner which opens up a few options below it: I click the 'Add' button and I can add a new tab. A dialogue opens where I can add a web page and then I grab the URL of another Story Map that has some of it's own tabs created, paste it in and it will populate the tab with the additional Story map and the new tier of tabs. Here's my issue: Today, I have decided to configure a new story map using the New ArcGIS Story map app. I've added some content to a 'Collection' and published the new story map. I want to embed this new story map under a new top tier tab in my original classic story map but I am getting the following message: I have checked and re-checked the URL. I have grabbed it both from the Item page of the new ArcGIS Story Map and the URL from the Address bar after I open the Story Map and I keep getting the same behavior. I have even created some very simple test Story Maps and re-tried adding to the Classic Story map and I keep getting the same behavior. For what it's worth, all my URL's use https as opposed to http (I've read that http can cause some issues) so that doesn't appear to be my problem. I'm out of ideas and options. Can anyone suggest a solution? Thanks
... View more
08-26-2021
09:55 AM
|
1
|
2
|
1136
|
POST
|
Thanks again @DougBrowning I think the coding you are providing is correct and you are right. I am trying this on a table but I also tested on a layer as well and it just doesn't seem to be accessing either of them with the cursor. I did come across an ESRI support document that speaks to the errors I am receiving and how a map service can't access the attribute table, but according to the metadata on my hosted feature service, it is a feature layer, not a map service:
... View more
06-25-2021
09:40 AM
|
0
|
1
|
2473
|
POST
|
Thanks @DougBrowning I tested your suggestion (think that was a similar approach in one of the other links I posted above) and it returns the following error: RuntimeError: RecordSetObject: Cannot open table for Load So, there's something that is preventing the cursor from opening/accessing the table...
... View more
06-24-2021
02:25 PM
|
0
|
1
|
2502
|
POST
|
Thanks @jcarlson for the effort to your response! Much appreciated. We are exploring the idea of a scheduled script, however I was hoping there was a more automatic way. We tested using Attribute Rules on the table when built in Pro, but they do not carry over when you publish the geodatabase as a hosted feature layer. Thanks to @BrittanyBurson for responding to my other question about this here. This may be a function coming in ArcGIS Online, which would be a great function!
... View more
06-24-2021
02:00 PM
|
1
|
0
|
3030
|
POST
|
I am trying to use arcpy cursors on a hosted feature layer containing a geodatabase with multiple tables and feature classes. After digging around the internet, a few posts seem to allude that I can do this: https://gis.stackexchange.com/questions/363932/how-can-i-use-updatecursor-in-agol-layers https://community.esri.com/t5/arcgis-api-for-python-questions/updatecursor-with-a-hosted-table/td-p/781002 Whereby, it seems the process is to: Access ArcGIS Online account Search for the hosted feature layer in my content Use the URL for the item as the first parameter in the arcpy cursor (i.e. arcpy.da.SearchCursor(item.url, fields)) Run Cursor So, code looks something like this: from arcgis.gis import GIS
import arcpy
gis = GIS("https://www.arcgis.com", "username", "password")
hfl = gis.content.get('itemitd')
url = hfl.tables[8]
with arcpy.da.SearchCursor(url, '*') as cursor:
for row in cursor:
print(row) Which returns the following error: RuntimeError: cannot open 'https://services6.arcgis.com/yadda/arcgis/rest/services/nameofhostedfeaturelayer/FeatureServer/10' I tried using a slightly different approach to grab the item, but is pretty much the same as the above: hfl = gis.content.search(query="title:nameofhostedfeaturelayer, owner:username", max_items=1000)
url = hfl[0].tables[8].url
with arcpy.da.UpdateCursor(url , "*") as cursor:
for row in cursor:
row[0] = "hello"
cursor.updateRow(row) Which yields the same error. Couple notes: I own the data It is shared to a few groups, but not publicly I've allowed edits on the hosted feature layer and any other setting that may or may not allow the script to see and read the hosted feature layer It appears I do have access to the hosted feature layer and I can perform other operations on it such as printing out items or values: for v in hfl.values():
print(o)
for i in hfl.items():
print(c) Any suggestions why I am receiving that error?
... View more
06-24-2021
01:50 PM
|
0
|
7
|
2512
|
POST
|
I created a polygon feature class in ArcGIS Pro that contains 3 text fields. I added a 2 simple Attribute Rule to two of the fields. One that just adds 2+3 when a new feature is added or an existing feature is updated and then one that jsut concatenates 2 strings together (i.e. "My" + "_test"). I validated each rule and both past validation. The tested the rules in ArcGIS Pro by adding a new record and they work. The first field updates the calculated value (5) automatically when the feature is added and the second field concatenates the strings. Same thing when the feature is edited. My purpose was to see if those attribute rules carry over into ArcGIS Online, so I published the geodatabase containing the feature class as a hosted feature layer into AGO. I enabled editing on the settings of the hosted feature layer and then added it to a map. I tried editing the layer in the map by clicking the 'Edit' button on the layers properties and then choose 'Add a New Feature' and tried clicking in the map to start drawing a new polygon. At this point the map freezes up and won't allow me to start drawing. In the image below, you can see I have editing enabled, but when I hover my cursor in the map and start clicking, nothing happens. When I try to scroll around in the map, it won't. It just freezes. I tested the above in the new Map Viewer. I went on to test in the old map viewer and it will allow me to add a feature, however the attribute rules don't update the fields that are applied to. So, question. Should attribute rules work in ArcGIS Online? If so, why is the new map viewer freezing? Why don't they seem to work in the old map viewer when I add or edit a feature? If I add a feature class with no attribute rules, I don't have an issue adding features in either map viewer.
... View more
06-18-2021
02:38 PM
|
0
|
1
|
937
|
POST
|
Thanks @MehdiPira1 We came across the table properties as you outlined above after I posted. We're slowly understanding some of these functions, despite the fact that ESRI is really lacking in quality documentation on the API. You're examples are great. Thanks for the help.
... View more
06-17-2021
03:16 PM
|
0
|
1
|
3428
|
POST
|
Hey everyone, I am just wondering if there is a way to update a field in a hosted feature layer automatically when a new row is added. For example, say I have a table in my hosted feature layer and it contains 5 fields. To keep it simple, let's say one of the fields is a string field and is populated by concatenating 2 other fields. Currently, I have to manually run a field calculator to update that field each time a new row is added. I was hoping there was a way to store the field calculator formula in the field and every time a new row is added, it just automatically updates that field or possibly any other method that was automatically update a field. Is this doable? Thanks
... View more
06-17-2021
02:59 PM
|
0
|
6
|
3187
|
POST
|
It might be the casing of your user name. It's case sensitive using the API, so you must match how it was set. In my situation, my username was set as all caps, so my script will only accept my username in that format.
... View more
06-16-2021
12:04 PM
|
0
|
0
|
926
|
POST
|
We are working with an existing Hosted Feature Layer in ArcGIS Online. The Hosted Feature Layer was created from a geodatabase and contains a number of feature classes and tables. 4 of the tables contain a a common field (let's call it "myField") that we want to update using the ArcGIS API for Python to calculate the fields. Drawing from my experience from arcpy, I would do something like: Access the geodatabase List out the tables Iterate over the fields in those tables to find the tables that contains a field called "myField" Run a calculate field function to calculate those fields based off of some logic. So, in the API I have this so far to access my account and to grab an item (hosted feature layer) and calculate: from arcgis.gis import GIS
import arcpy
gis = GIS("http://governmentofbc.maps.arcgis.com", "username", "password")
hfl = gis.content.get(itemid)
hfl.calculate(where="OBJECTID = 1", calc_expression={"field": "myField", "value" : 1}) So, that worked on a hosted feature layer that contains only one table. As mentioned, mine has a number of tables so I need to grab the specific table(s) and calculate the "myField" field(s). So, I tried to list out the tables of the hfl (hosted feature layer): for t in hfl.tables:
print(t) Which will return: <Table url:"https://services6.arcgis.com/~yadda~/arcgis/rest/services/~yaddaitemid~/FeatureServer/2"> <Table url:"https://services6.arcgis.com/~yadda~/arcgis/rest/services/~yaddaitemid~/FeatureServer/3"> <Table url:"https://services6.arcgis.com/~yadda~/arcgis/rest/services/~yaddaitemid~/FeatureServer/4"> <Table url:"https://services6.arcgis.com/~yadda~/arcgis/rest/services/~yaddaitemid~/FeatureServer/5"> <Table url:"https://services6.arcgis.com/~yadda~/arcgis/rest/services/~yaddaitemid~/FeatureServer/6"> <Table url:"https://services6.arcgis.com/~yadda~/arcgis/rest/services/~yaddaitemid~/FeatureServer/7"> So, that function returns the URL's for the tables inside of the Hosted Feature Layer by index. I tried running the calculate on those tables, so I thought I could do something like: for t in hfl.tables:
print(t)
if t == r'<Table url:"https://services6.arcgis.com/~yadda~/arcgis/rest/services/~yaddaitemid~/FeatureServer/8">':
t.calculate(where="OBJECTID = 1", calc_expression={"field": "myField", "value" : 1}) Which seems to run fine without any errors, but it doesn't calculate the field. This is where I am at. I'm not convinced the way I access the tables in order to calculate the fields is correct. This is where I need some help. As a side note, what I would also like to do (if possible) is grab some more properties of each of those tables. Like maybe access the table name or table index? Something similar to arcpy's method: for t in arcpy.ListTables():
print(t.name)
if t.name == 'myTableName':
#do something I'd like to also list out the fields of each table by name, similar to arcpy's method: for f in arcpy.ListFields():
print f.name
if f.name == 'myField':
arcpy.CalculateField(#some calculate logic) I'm looking to do much of the same rudimentary data management one can do on a geodatabase containing tables and fields one would do in arcpy. (i.e. list feature classes, list tables, list files, list fields, etc, etc) The help document for the ArcGIS API for Python is quite lacking in both explanations and code examples.
... View more
06-16-2021
11:10 AM
|
0
|
3
|
3500
|
POST
|
I outlined that as an issue in my post. After dragging the data into the Location field for the sole purpose of getting a map to populate so I can use the data I actually want to use from AGOL, is useless for my usage case.
... View more
06-10-2021
08:05 AM
|
2
|
0
|
3147
|
POST
|
It is not. It is polygons of land rights. Is ArcGIS for Power BI so restrictive, it can only handle that kind of "standard" data?
... View more
06-10-2021
07:59 AM
|
0
|
1
|
1517
|
POST
|
I am trying to learn how to iterate over a table stored as a feature service in my ArcGIS Online Content. I am just getting started with the Javascript API for ArcGIS so my knowledge isn't top level yet. What I am trying to do it dynamically update a URL using values from 2 columns in the table. I want to iterate through each row and grab the value from the 2 columns and inject them into a URL via concatenation. Drawing from my python background, it would be something like: URL = www.mywebsite.com
for row in cursor:
URL + "\" + row[1] + "some_other_URL_string_stuff" + row[2] I think what I need to do is use the following code to do so, but I am not sure how to reference the table in the script. I've tried setting the element ID to the GUID of the feature table but that doesn't seem to work. I've also tried the name. I've combed through the Javascript help docs, but they are difficult to navigate and I can't seem to find examples of what I am trying to do. I don't really know how to concatenate the values from the columns in the table using javascript. var table = document.getElementById("mytab1");
for (var i = 0, row; row = table.rows[i]; i++) {
//iterate through rows
//rows would be accessed using the "row" variable assigned in the for loop
for (var j = 0, col; col = row.cells[j]; j++) {
//iterate through columns
//columns would be accessed using the "col" variable assigned in the for loop
}
}
... View more
06-09-2021
04:27 PM
|
0
|
1
|
747
|
Title | Kudos | Posted |
---|---|---|
2 | 06-10-2021 08:05 AM | |
1 | 09-03-2014 04:30 PM | |
1 | 09-01-2021 08:14 AM | |
1 | 08-26-2021 09:55 AM | |
1 | 06-24-2021 02:00 PM |
Online Status |
Offline
|
Date Last Visited |
2 weeks ago
|