POST
|
Your attempt is not working because: $feature.yourDateField returns a single value from a feature. There's nothing to count. Then you compare that single value to ISOWeek(Now()), which only tells you if that single date value matches the current ISOWeek value (1-53). If it does match, you're simply returning the text string 'Count'. You should use the Count() function with a filter for the current week, but the way to do that depends on where you're trying to display this information. Is this for a dashboard indicator, or?
... View more
yesterday
|
0
|
0
|
19
|
POST
|
Hi Dave, yes you would have to specify the layers in an Arcade expression and configure the popup according to your layers/expression(s). Possibly a better user experience but you'd have to decide if maintaining is worth it if your map layers change frequently. If you decide that the Select widget is the way to go, this seems to work for me: 1. Enable "spatial selection" on the Select widget configuration, with your parishes as the selecting data. 2. Open your Experience and open the Select widget (unless it's configured to open automatically on load). 3. Click a parish to select it. 4. In the Select widget, activate the tool by clicking the button in the upper right so it turns blue**, then click the dropdown and choose Select by Data: 5. Click Apply: Now your features from the other layer are selected: ** I wonder if this is where you're running into trouble, since it doesn't really make sense to me that you would have to activate the interactive selection tool to use Select by Data, but you do.
... View more
a week ago
|
1
|
0
|
60
|
POST
|
Hi Dave, if returning data in the popup is your only requirement, would an Arcade intersect not work, skipping the Select widget entirely and just showing the data on click?
... View more
a week ago
|
0
|
0
|
91
|
POST
|
Acquiring an access token does not incur credits. There are lots of ways to acquire one, depending on how you're developing, with /generateToken: Generate Token | ArcGIS REST APIs | ArcGIS Developers being one. The Python API has a method as well: gis._con.token
... View more
2 weeks ago
|
0
|
0
|
54
|
POST
|
HI Jasper, I believe the information you're looking for is in the service/layer definitions, which are not viewable through ArcGIS Assistant. Go to the item page, and in the lower right, copy the URL: Paste it into your browser, appending ?f=json to the end, and if the service is secure, adding &token=<your access token>, like this: https://services6.arcgis.com/RTYCWyATq5TpQEkX/arcgis/rest/services/service_f2262bfc9e9a47d0abde66b369ac2579/FeatureServer?f=json&token=<your access token> This will give you the service (aka Feature Layer Collection) definition, including layer/table names and IDs. From there, you can access the layer definitions by adding the layer IDs to the URL, e.g.: https://services6.arcgis.com/RTYCWyATq5TpQEkX/arcgis/rest/services/service_f2262bfc9e9a47d0abde66b369ac2579/FeatureServer/1?f=json&token=<your access token> For the target layers, Update Definition (Feature Layer)—ArcGIS REST APIs | ArcGIS Developers is likely your ticket. You can also use the ArcGIS API for Python: https://developers.arcgis.com/python/latest/guide/updating-feature-layer-properties
... View more
2 weeks ago
|
0
|
0
|
74
|
IDEA
|
Try this. It will create a CSV item in your portal with the additional information. Yes, running in a Notebook is probably easiest if you're not familiar with Python. Please note that it's not guaranteed that this will get all 3x items, and it may get some that are not relevant. Esri doesn't have documentation on how these are defined by keyword, so this is my attempt based on what I see in the portals I use. import pandas as pd
from arcgis.gis import GIS
import time
gis = GIS("home")
classic_webmaps = []
classic_storymaps = []
web_appbuilder_apps = []
classic_configurable_apps = []
all_items = gis.content.search(query='', item_type='Map', max_items=10000) # item_type = 'Map' gets both Web Map and Web Mapping Application items
for item in all_items:
if item.type == "Web Map":
if not "ArcGIS API for JavaScript" in item.typeKeywords: # this keyword may indicate 4x map
classic_webmaps.append(item)
if item.type == "Web Mapping Application":
if "Story Map" in item.typeKeywords and not "StoryMap" in item.typeKeywords: # keyword 'Story Map' (with a space) may indicate classic Story Map
classic_storymaps.append(item)
if any(keyword in item.typeKeywords for keyword in ["Web AppBuilder", "WAB2D"]):
web_appbuilder_apps.append(item)
if not any(keyword in item.typeKeywords for keyword in ["Web AppBuilder", "WAB2D", "configurableApp", "Ready To Use"]): # 'configurableApp' and 'Ready to Use' may indicate 4x instant app, so we are excluding these
classic_configurable_apps.append(item)
export_data = []
def add_items_to_export(items):
for item in items:
export_data.append({
"Title": item.title,
"ID": item.id,
"Owner": item.owner,
"URL": item.url or "N/A",
"Modified": item.modified,
"Type": item.type,
"Shared With": item.sharing.shared_with
})
add_items_to_export(classic_webmaps)
add_items_to_export(classic_storymaps)
add_items_to_export(web_appbuilder_apps)
add_items_to_export(classic_configurable_apps)
df = pd.DataFrame(export_data)
csv_path = f"arcgis\\home\\categorized_items_{int(time.time())}.csv"
df.to_csv(csv_path, index=False)
csv_properties = {
"title": f"Potential_Retiring_Items_{int(time.time())}",
"type": "CSV",
}
csv_item = gis.content.add(item_properties=csv_properties, data=csv_path)
print(f"CSV item created: {csv_item.title} (ID: {csv_item.id})")
... View more
11-22-2024
10:29 AM
|
0
|
0
|
117
|
IDEA
|
This script might help: from arcgis.gis import GIS
gis = GIS("home")
classic_webmaps = []
classic_storymaps = []
web_appbuilder_apps = []
classic_configurable_apps = []
all_items = gis.content.search(query='', item_type='Map', max_items=10000) # item_type = 'Map' gets both Web Map and Web Mapping Application items
for item in all_items:
if item.type == "Web Map":
if not "ArcGIS API for JavaScript" in item.typeKeywords: # this keyword may indicate 4x map
classic_webmaps.append(item)
if item.type == "Web Mapping Application":
if "Story Map" in item.typeKeywords and not "StoryMap" in item.typeKeywords: # keyword 'Story Map' (with a space) indicates classic Story Map
classic_storymaps.append(item)
if any(keyword in item.typeKeywords for keyword in ["Web AppBuilder", "WAB2D"]):
web_appbuilder_apps.append(item)
if not any(keyword in item.typeKeywords for keyword in ["Web AppBuilder", "WAB2D", "configurableApp", "Ready To Use"]):
classic_configurable_apps.append(item)
print(f"--------\nThe following {len(classic_webmaps)} web maps may not have been saved in the new Map Viewer:\n")
for map in classic_webmaps:
print(f"{map.title} ({map.id})")
print(f"\n--------\nThe following {len(classic_storymaps)} apps may be classic/3x Story Maps:\n")
for app in classic_storymaps:
print(f"{app.title} ({app.id})")
print(f"\n--------\nThe following {len(web_appbuilder_apps)} apps are Web AppBuilder apps:\n")
for app in web_appbuilder_apps:
print(f"{app.title} ({app.id})")
print(f"\n--------\nThe following {len(classic_configurable_apps)} apps may be classic/3x configurable apps:\n")
for app in classic_configurable_apps:
print(f"{app.title} ({app.id})")
... View more
11-21-2024
05:41 PM
|
0
|
0
|
148
|
POST
|
Does anyone know what determines the units on the measure tool in Field Maps? I've got a map where all data is in state plane, except the Esri basemaps, which are of course Web Mercator. We want to be able to measure in feet. Do the units of the spatial reference of the basemap determine the units in the measure tool, since the basemap determines the spatial reference of the web map? If so, that would mean that meters are the only option when using Esri basemaps?
... View more
11-21-2024
01:21 PM
|
0
|
3
|
115
|
POST
|
I replied to your other post, but for anyone coming across this post, here's how I did this: 1. In the app configuration, go to Interactivity -> Share, and toggle on Sharing. 2. Publish then open the app and select any feature by clicking on it. 3. Click the Sharing button, then Copy Link. This copies a shortened link to the clipboard. 3. Paste the link in the address bar and press Enter to load the app. This changes the shortened link to the full link in the address bar. It looks like this: https://civiclens-demo.maps.arcgis.com/apps/instant/attachmentviewer/index.html?appid=bc91f23560d9436fa069f28d980db38c&defaultObjectId=14&attachmentIndex=0&layerFeatureIndex=0&selectedLayerId=190ffe37ae2-layer-4¢er=-114.05;46.8919&level=19 4. From my testing, you can just swap out the defaultObjectId value to open the app to the feature of interest. You can also omit the layerFeatureIndex parameter (I'm not sure what it does), but it looks like you need most or all of the others. Hope this helps.
... View more
08-13-2024
11:33 AM
|
0
|
1
|
358
|
POST
|
Hi, this is possible; here's how: 1. In the app configuration, go to Interactivity -> Share, and toggle on Sharing. 2. Publish then open the app and select any feature by clicking on it. 3. Click the Sharing button, then Copy Link. This copies a shortened link to the clipboard. 3. Paste the link in the address bar and press Enter to load the app. This changes the shortened link to the full link in the address bar. It looks like this: https://civiclens-demo.maps.arcgis.com/apps/instant/attachmentviewer/index.html?appid=bc91f23560d9436fa069f28d980db38c&defaultObjectId=14&attachmentIndex=0&layerFeatureIndex=0&selectedLayerId=190ffe37ae2-layer-4¢er=-114.05;46.8919&level=19 4. From my testing, you can just swap out the defaultObjectId value to open the app to the feature of interest. You can also omit the layerFeatureIndex parameter (I'm not sure what it does), but it looks like you need most or all of the others. Hope this helps.
... View more
08-13-2024
11:31 AM
|
0
|
0
|
219
|
POST
|
I discovered a partial solution, which is to construct the attachment URLs and generate an API key to append to the URLs for access, then return as a mediaInfos element. API keys only last for up to one year, so I'm still curious if this is possible without a token or API key. Here's how I did it by constructing the attachment URLs and using an API key: var keyword = "my_keyword"; // keyword to filter by
var atts = Attachments($feature);
var filteredAttachments = [];
var mediaInfos = []
var apiKey = YOUR_API_KEY_GOES_HERE
for (var i = 0; i < Count(atts); i++) {
var attachment = atts[i];
if (attachment.keywords == keyword) {
Push(filteredAttachments, attachment);
}
}
var baseUrl = "https://services9.arcgis.com/iERBXXD4hiy1L6en/ArcGIS/rest/services/Testing_Attachments/FeatureServer/0";
for (var j = 0; j < Count(filteredAttachments); j++) {
var attachment = filteredAttachments[j];
var attachmentUrl = baseUrl + "/" + $feature.OBJECTID + "/attachments/" + attachment.id + "?token=" + apiKey;
Push(mediaInfos, {
"type": "image",
"caption": "test",
"value": {"sourceURL": attachmentUrl}
}
)
}
return {
"mediaInfos": mediaInfos,
"type": "media"
};
... View more
07-24-2024
12:44 PM
|
0
|
0
|
288
|
POST
|
I need to display attachments from a secure service in a popup, filtered by keyword. I can retrieve and filter the attachments using Arcade, but I can't seem to return the attachments to the popup. I'm hoping it's just a syntax issue, but I'm starting to wonder if this is even possible. Here's my latest attempt: var keyword = "my_keyword";
var atts = Attachments($feature);
var filteredAttachments = [];
for (var i = 0; i < Count(atts); i++) {
var attachment = atts[i];
if (attachment.keywords == keyword) {
Push(filteredAttachments, attachment);
}
}
Console(filteredAttachments)
return {
"attachment": filteredAttachments,
"type": "attachment",
"displayType": "auto"
} This logs the following to the console, so everything is good up to the return statement. [{"id":2,"name":"Discrepancies_image-20240321-155540-91b088a433494fb5aebd156de9c225e4-75a31dfa6c20461183d7004d680f0a78.jpg","contenttype":"image/jpeg","size":244565,"exifinfo":null,"keywords":"my_keyword"}] I can't use the method of constructing the attachment URL because there's no way to provide a token. I've tried a dozen different iterations of the return statement. Is it possible to filter attachments by keyword in Map Viewer popups?
... View more
07-23-2024
06:56 PM
|
2
|
1
|
351
|
POST
|
Looks like this is still an issue in ArcGIS Pro 3.3./Python API 2.3.0. If arcpy is available, @Vincentvd's solution works, but we had a need to find a workaround when arcpy wasn't available. I've had success using the authenticated session object for REST API and Sharing API calls to secured services instead of passing the token explicitly, like so (only tested on AGOL): import json
from arcgis.gis import GIS
gis = GIS("pro")
# Use the session from the GIS object
session = gis._con._session
# Example secured URL, doesn't have to be admin, just an example
update_definition_url = "https://services8.arcgis.com/XXXXXXXXXXXXXXXX/arcgis/rest/admin/services/XXXXXXXXXXX/FeatureServer/updateDefinition"
# Define some parameters for the update; again, just an example
update_def_params = {
'updateDefinition': json.dumps({
"capabilities": "Query,Editing,Create,Update,Delete,Sync"
}),
'async': 'false',
'f': 'json'
}
response = session.post(update_definition_url, data=update_def_params, timeout=10)
result = response.json()
print(result) This apparently provides a subclass of a Requests session, so you can use it in place of requests; e.g., session.get, session.post, etc. Your mileage may vary, but this solved the problem for me in a workflow where arcpy wasn't an option.
... View more
06-03-2024
04:01 PM
|
1
|
1
|
1001
|
POST
|
Try this: import copy
def update_cyano_status(cyanoponds_features, overlap_rows, cyanoponds_lyr):
for CCC_GIS_ID in overlap_rows['CCC_GIS_ID']:
cyanopond_feature = [f for f in cyanoponds_features if f.attributes['CCC_GIS_ID'] == CCC_GIS_ID][0]
row = overlap_rows[overlap_rows['CCC_GIS_ID'] == CCC_GIS_ID].iloc[0]
cyanopond_feature_copy = copy.deepcopy(cyanopond_feature)
cyanopond_feature_copy.attributes['Cyano_Status'] = row['cyano_risk_tier']
resp = cyanoponds_lyr.edit_features(updates=[cyanopond_feature_copy])
print(f"Attempted to update Cyano_Status for {CCC_GIS_ID} to {row['cyano_risk_tier']}. Response: {resp}")
... View more
05-14-2024
03:22 PM
|
0
|
2
|
548
|
Title | Kudos | Posted |
---|---|---|
1 | a week ago | |
1 | 05-07-2024 08:35 AM | |
1 | 12-08-2023 01:23 PM | |
1 | 11-17-2023 08:23 AM | |
2 | 07-23-2024 06:56 PM |
Online Status |
Online
|
Date Last Visited |
3 hours ago
|