POST
|
Hi Sean, here's how we do that: Add ¢er=<lat>,<long> to the end of the link that opens Survey123 (ex: ¢er=40.3798956137812,-122.98043757805). On the geopoint question in your survey's XLSform, set required=yes, readonly=yes, and default=null. You'll need to use an Arcade expression to get the lat-long values. If your Field Maps point data happens to be in 4326 (WGS 84), you can just add "¢er=" + Geometry($feature).y + ',' + Geometry($feature).x to the expression that builds your link (or if you happen to already have lat/long values elsewhere in the table, you can just use those, of course). If your Field Maps point data is in another projection, it gets a bit trickier because you have to convert to lat/long. Let me know if this is the case and I'll see if I can help you convert those values in your popup.
... View more
Wednesday
|
0
|
0
|
26
|
POST
|
When accessing datasets from the content library, we're experiencing intermittent "Page Not Found" errors. These seem to always resolve when the page is refreshed, but the public understandably assumes that the link is broken. Here's an About page for a layer when accessed from the content library: When refreshed, we get the correct page: Same URL, nothing changed on the service, just a click of the refresh button. Does anyone know if there's a bug logged for this?
... View more
Wednesday
|
0
|
0
|
82
|
BLOG
|
@jsarthur @TomScavo I happened to notice that disabling extract on the feature service forces the old download sidebar and brings back the KML download option, at least for now. Hopefully KML will be added back to the new download experience.
... View more
Monday
|
4
|
0
|
207
|
POST
|
Same issue here. @sredar's workaround is great for my current project (thanks), but there are lots of other cases where arcpy isn't available and I need to get an access token from the GIS object.
... View more
a week ago
|
0
|
0
|
33
|
POST
|
Hi Tyler - good solution, thanks. The buttons still show on the form, but it gives an error on submission if you try to add or delete a related record.
... View more
a month ago
|
0
|
0
|
79
|
POST
|
We are attempting to design a survey to be accessed via web form that allows review of survey records previously submitted from the field. To do this, I've created two surveys, one for field collection via the mobile app, and a second one that points to the same feature service using the submission URL parameter, with all fields set to read only with the exception of a few additional fields for entering review information. This works fine, except that the repeats are still editable in the sense that they can be deleted or added using the buttons in the web form: We can imperfectly get around accidental additions by making the fields in the repeat required and read-only (so it won't let them submit), but it seems that reviewers are still able to delete records from the repeat using the trash can button. I've tried setting the [begin repeat] line to read-only, and have also tried setting the [bind::esri:parameters] column on the [begin repeat] line to allowUpdates=false and allowAdds=false, and neither seems to have any effect. Is there any way to allow the repeats to be shown on the web form but not allow them to be added to or deleted?
... View more
a month ago
|
0
|
3
|
204
|
POST
|
Thanks Michael, this was super helpful and got my script working. To piggyback on this, if retrieving the index name programmatically is desired, you can do it like this: import requests
from arcgis.gis import GIS
from arcgis.features import FeatureLayerCollection
gis = GIS(portal_url, username, password)
token = gis._con.token
item = gis.content.get(item_id)
layer_index = 0
service_definition_url = f"{item.url}/{layer_index}/?token={token}&f=json"
response = requests.get(service_definition_url)
service_definition = response.json()
for index in service_definition["indexes"]:
if index["fields"].lower() == "shape":
shape_index_name = index["name"]
break
flc = FeatureLayerCollection.fromitem(item)
update_dict = {"indexes":[{"name": shape_index_name,
"fields": "Shape"}]}
result = flc.layers[layer_index].manager.update_definition(update_dict)
if result:
print(f"\nSpatial index successfully rebuilt for {item.title} ({item.id}), Layer {layer_index}")
... View more
02-08-2024
06:15 PM
|
1
|
0
|
240
|
POST
|
Thanks again, Chris. The Windows 11 devices where it's failing are not mobile devices (they are both Dell XPS notebooks). Would I need to open a support ticket to get these device types added to the bug description (or logged as a new one)?
... View more
02-01-2024
09:29 AM
|
0
|
1
|
434
|
POST
|
Hi Chris, Thanks for the reply. I tested on the five devices I have available; here are the results: Windows 10 (Edge 121.0.2277.83): App works as expected! Windows 11 (Edge 120.0.2210.144): Issue persists Windows 11 (Firefox 122.0): Issue persists iPad running iOS 15.6.1 (Safari): Issue persists iPhone running iOS 17.0 (Safari): Issue persists I noticed that when I enter full screen on the one device that works, I get the "Press Esc to exit full screen" modal, but this doesn't happen on the other Windows devices.
... View more
02-01-2024
09:13 AM
|
0
|
3
|
443
|
POST
|
Hi Chris, Yes, I'm using AGOL. Here is an example: Address & Parcel Viewer (arcgis.com) I see the same behavior in Edge and Firefox on Windows, as well as Safari on iOS.
... View more
02-01-2024
07:26 AM
|
0
|
5
|
458
|
POST
|
Hi Aaron, this will delete a specific user's map areas. I've found the user.items() query to be lacking as well, so I always query user items with gis.content.search, like so: from arcgis.gis import GIS
gis = GIS("home")
username_to_search = ''
user_map_areas = gis.content.search(query=f"owner:{username_to_search}",
item_type='Map Area',
max_items=10000
)
for area in user_map_areas:
try:
delete_result = area.delete()
if delete_result:
print(f"Map area '{area.title}' ({area.id}) deleted.")
except Exception as e:
print(f"! Deletion failed for map area '{area.title}' ({area.id}). Exception: {e}")
... View more
01-31-2024
08:16 PM
|
0
|
0
|
212
|
POST
|
The full screen button on the map widget doesn't work to exit full screen - nothing at all happens when it's clicked while in full screen mode (doesn't exit full screen, and nothing logged to the console). Pressing Esc does nothing. Is the ExB team aware of this? The extent navigation, measure, select, basemap, and layer list buttons also do nothing while in full screen mode. @TonghuiMing
... View more
01-31-2024
07:23 AM
|
2
|
8
|
556
|
POST
|
It's probably all the empty field names. Hard to say without seeing the actual CSV.
... View more
01-21-2024
03:45 PM
|
0
|
0
|
293
|
POST
|
Hi, I see two issues right away: There are no features in the addFeatures payload. You must pass an array of features to be added. addFeatures does not accept a 'where' parameter. You need to query your hosted (ArcGIS Online) feature layer, then pass those features to the 'features' parameter of the addFeatures payload. If you're wanting to do this in chunks, the chunks would be best handled on the query; in other words, query 2000 records and add them, then query the next 2000 and add those, etc. If you have attachments, those will need to be handled separately. But this should move your features over in 2000-feature chunks: import requests
import json
source_service_url = ""
destination_service_url = ""
batch_size = 2000
offset = 0
while True:
query_url = f"{source_service_url}/query"
query_params = {
"f": "json",
"where": "1=1", # Change if you want to specify which features to query from source
"outFields": "*",
"resultOffset": offset,
"resultRecordCount": batch_size,
"token": agoltoken
}
query_response = requests.get(query_url, params=query_params)
features = query_response.json().get("features")
if not features:
break # no more features to process
add_url = f"{destination_service_url}/addFeatures"
add_params = {
"f": "json",
"features": json.dumps(features),
"token": portaltoken
}
add_response = requests.post(add_url, data=add_params)
offset += batch_size
... View more
01-21-2024
01:59 PM
|
0
|
5
|
432
|
POST
|
This should work for you, or hopefully put you on the right track. The code below will delete ALL features in your service in 2000-record chunks, unless you modify the where_clause variable to specify only certain features. Use with caution. You may also want to look at Truncate (Feature Layer)—ArcGIS REST APIs | ArcGIS Developers if you are truly trying to delete every feature. import requests
feature_layer_url = "https://<your_server_url>/arcgis/rest/services/<some_feature_service>/FeatureServer/0"
where_clause = "1=1" # this will grab all features, or you can replace with a different where clause. The objectid chunks will be handled later.
batch_size = 2000
while True:
query_url = f"{feature_layer_url}/query?where={where_clause}&returnIdsOnly=true&f=json&token={portaltoken}"
query_result = requests.get(query_url).json()
object_ids = query_result.get("objectIds", [])
if not object_ids:
break # No more features to delete
for i in range(0, len(object_ids), batch_size):
batch_ids = object_ids[i:i + batch_size]
where_clause_with_ids = f"{where_clause} AND OBJECTID >= {min(batch_ids)} AND OBJECTID <= {max(batch_ids)}"
delete_params = {
'where': where_clause_with_ids,
'f': 'json',
'rollbackOnFailure': True,
'token': portaltoken
}
response = requests.post(f"{feature_layer_url}/deleteFeatures", data=delete_params)
delete_result = response.json()
if 'deleteResults' in delete_result:
deleted_features = delete_result['deleteResults']
for feature in deleted_features:
if 'success' in feature and feature['success']:
print(f"Deleted feature with objectId {feature['objectId']}")
else:
print(f"Failed to delete feature with objectId {feature['objectId']}")
else:
print(f"Error deleting features. Response: {delete_result}")
... View more
01-19-2024
01:47 PM
|
0
|
0
|
250
|
Title | Kudos | Posted |
---|---|---|
4 | Monday | |
1 | 02-08-2024 06:15 PM | |
2 | 01-31-2024 07:23 AM | |
1 | 11-15-2022 08:59 AM | |
1 | 01-18-2024 11:42 AM |
Online Status |
Offline
|
Date Last Visited |
Wednesday
|