POST
|
I don't think so. I did some playing around and I think the attribute relationship needs the { }, but now I'm having an error with the summary fields, just saying "Job Failed". joinData = join_features(target_layer=facilities, join_layer=counties, output_name="Facility_county_join", join_operation="JoinOneToOne", spatial_relationship="", attribute_relationship={"NAME", "Facility"}, summary_fields=["Current_Status", "SUM"])
... View more
03-03-2021
06:30 AM
|
0
|
0
|
3737
|
POST
|
Hello everyone, I am trying to create a join between 2 hosted feature layers in ArgGIS API for Python (on ArcGIS Online). I keep receiving a type error and I'm not really sure how to approach it. Exception: A general error occurred: Object of type 'set' is not JSON serializable Here is the code and the output: joinData = join_features(target_layer=facilities, join_layer=counties, output_name="Facility_county_join", join_operation="JoinOneToOne", spatial_relationship="", attribute_relationship=[{"NAME", "Facility"}], summary_fields=[{"Current_Status", "SUM"}]) TypeError Traceback (most recent call last)
/opt/conda/lib/python3.6/site-packages/arcgis/gis/_impl/_con/_connection.py in post(self, path, params, files, **kwargs)
662 if isinstance(v, (dict, list, tuple, bool)):
--> 663 params[k] = json.dumps(v)
664 elif isinstance(v, PropertyMap):
/opt/conda/lib/python3.6/json/__init__.py in dumps(obj, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, default, sort_keys, **kw)
230 default is None and not sort_keys and not kw):
--> 231 return _default_encoder.encode(obj)
232 if cls is None:
/opt/conda/lib/python3.6/json/encoder.py in encode(self, o)
198 # equivalent to the PySequence_Fast that ''.join() would do.
--> 199 chunks = self.iterencode(o, _one_shot=True)
200 if not isinstance(chunks, (list, tuple)):
/opt/conda/lib/python3.6/json/encoder.py in iterencode(self, o, _one_shot)
256 self.skipkeys, _one_shot)
--> 257 return _iterencode(o, 0)
258
/opt/conda/lib/python3.6/json/encoder.py in default(self, o)
179 raise TypeError("Object of type '%s' is not JSON serializable" %
--> 180 o.__class__.__name__) 181
TypeError: Object of type 'set' is not JSON serializable
During handling of the above exception, another exception occurred:
Exception Traceback (most recent call last)
<ipython-input-26-cf1ae0f3dbb2> in <module>
5 spatial_relationship="",
6 attribute_relationship=[{"NAME", "Facility"}],
----> 7 summary_fields=[{"Current_Status", "SUM"}])
/opt/conda/lib/python3.6/site-packages/arcgis/features/summarize_data.py in join_features(target_layer, join_layer, spatial_relationship, spatial_relationship_distance, spatial_relationship_distance_units, attribute_relationship, join_operation, summary_fields, output_name, context, gis, estimate, future)
640 if 'summary_fields' not in params:
641 params['summary_fields'] = summary_fields
--> 642 return gis._tools.featureanalysis.join_features(**params)
/opt/conda/lib/python3.6/site-packages/arcgis/_impl/tools.py in join_features(self, target_layer, join_layer, spatial_relationship, spatial_relationship_distance, spatial_relationship_distance_units, attribute_relationship, join_operation, summary_fields, output_name, context, estimate, records_to_match, future)
2746 output_name=output_name,
2747 context=context, gis=self._gis,
-> 2748 future=True) 2749 gpjob._is_fa = True
2750 if future:
<string> in join_features(target_layer, join_layer, spatial_relationship, spatial_relationship_distance, spatial_relationship_distance_units, attribute_relationship, join_operation, summary_fields, records_to_match, output_name, context, join_type, gis, future)
/opt/conda/lib/python3.6/site-packages/arcgis/geoprocessing/_support.py in _execute_gp_tool(gis, task_name, params, param_db, return_values, use_async, url, webtool, add_token, return_messages, future)
388 job_info = gptool._con.post(submit_url, gp_params)
389 else:
--> 390 job_info = gptool._con.post(submit_url, gp_params)
391 job_id = job_info['jobId']
392 if future:
/opt/conda/lib/python3.6/site-packages/arcgis/gis/_impl/_con/_connection.py in post(self, path, params, files, **kwargs)
698 "URL scheme must be provided: %s" % errMS)
699 except Exception as e:
--> 700 raise Exception('A general error occurred: %s' % e)
701 except:
702 import traceback
Exception: A general error occurred: Object of type 'set' is not JSON serializable Thank you in advance!
... View more
03-03-2021
05:42 AM
|
0
|
5
|
3784
|
POST
|
Hello Everyone, I am exploring some options on some ways to archive data and I stumbled across this post https://developers.arcgis.com/javascript/3/jssamples/gp_popuplink.html that demonstrates a geoprocessing tool into a pop-up. I was wondering if anyone has any guidance on replacing the population tool with extract data or if something like this is even possible in an ArcGIS Online environment. Thanks!
... View more
02-18-2021
07:54 AM
|
0
|
0
|
486
|
POST
|
I am trying to create an Arcade script that, within the pop-up, will return the next closest feature within the same layer. In my case, if I click on a wildfire point, it will tell me what the next closest wildfire point is. I have has some success changing up the script found in lines 30-44 here, but what I have found is that my current script returns the point that is furthest from the selected point within the search distance. Any guidance on what I can do? var searchDistance =50;
var points = $layer
var closestPoint = Intersects(points, BufferGeodetic($feature, searchDistance, "Miles"));
var minDistance = Infinity
for(var listing in closestPoint){
var facilityDistance = Distance(listing, $feature, "miles");
if (facilityDistance < minDistance){
closestPoint = listing;
return closestPoint.iaName
}
};
... View more
02-02-2021
12:53 PM
|
0
|
3
|
1170
|
POST
|
I am trying to change the alias of an attribute field in Smart Editor, in this case, to make Address into Full Address. I read around that you can just double click and change it, but I can't get it to work. Am I missing something or is this not even possible? Thanks
... View more
01-12-2021
08:48 AM
|
0
|
2
|
931
|
POST
|
I am trying to create a python script (in rest API for Python) to make a replica of a feature layer view and then append the data into a hosted feature layer. This script is meant to run once a day to keep a record of that day's changes for a time enabled application and general record of changes. This view layer is a one-to-one point join layer and has added statistics and that statistic field is the important field. My colleague and I managed tinker with a detect edits script from Esri to pull the data from the hosted view (with a json file that helps build the REST URL). The script pulled the data correctly, however, the script just prints the data into the console as seen here: My thoughts on how I can get the data from the feature layer view to the log HFL are somehow taking the output here and appending the data to the log file, or changing the output from this print to create a file geodatabase or shapefile, then appending that and deleting the temporary gdb/shp. Either way, I don't know enough about Python to do these so I am looking for some guidance on how I might be able to accomplish this. I attached the code and its json file below. NOTE the code needs the Json file in the same folder as the .py file and needs an AGOL username and password to run. The feature layers are public and are a sandbox/ exercise version of the layers for my client. Any assistance would be appreciated. Thanks! -Adam
... View more
12-14-2020
02:35 PM
|
1
|
0
|
648
|
POST
|
Peter- I was running it on PyCharm, but after running it on the Acrpy environment in Pro I was able to download the data locally. Thanks!
... View more
12-14-2020
01:05 PM
|
0
|
0
|
3745
|
POST
|
Hi Peter, I ran into this article and tried it out on my end, but I am having issues with the layers downloading onto my machine. I got it to at least export the data and commented out the delete line to make sure they export, but I can't figure out what I'm doing wrong to have it download locally. Do you have any guidance?
... View more
12-08-2020
08:35 PM
|
0
|
4
|
3775
|
POST
|
I am trying to find a tool, script, or anything that would allow me to completely export a feature layer view. In short, I made a system that will change a point's status based on the counties around it and their status. That status of the counties is a simple domain (green=1, yellow=2, red=3). To make the point change color, I used a join one-to-one between the counties and points and use the "add statistics" to add the total of this number. It works great, however, the issue I have now is my client wants to have a log of those changes to have a time-enabled application. The counties are easy, but I have yet to find an effective way to export the points' (the feature layer view) data with the added statistic number. When I try to list export the data as a file geodatabase, I get an error saying the zip is invalid. Any help on how to fix this or workarounds would be appreciated. Thanks!
... View more
12-03-2020
04:31 PM
|
0
|
0
|
361
|
POST
|
Ken, How would I do that? I've been using the item ID of the feature layer and I'm not really sure what you mean by include the parent layer -Adam
... View more
10-26-2020
02:43 PM
|
0
|
1
|
732
|
POST
|
I currently have a web app that I want to create a URL parameter to only turn on one layer when that URL is selected. I found some documentation here but when I add in the "&showLayers=<featurelayerID>", the app opens with all the layers off. Is there something I am doing wrong? URL I am trying to get working (there's a space between https:// and the rest of the URL as I couldn't display it without it changing to "ArcGIS Online Web Application") is here: https:// napsg.maps.arcgis.com/apps/webappviewer/index.html?id=6dc469279760492d802c7ba6db45ff0e&showLayers=d957997ccee7408287a963600a77f61f I think it's something with the sublayer in the feature layer I am trying to display found here https://www.arcgis.com/home/item.html?id=60c390dd7f804f05b73177825a485277 Any guidance would be helpful. Thanks!
... View more
10-26-2020
12:54 PM
|
0
|
3
|
790
|
IDEA
|
In StoryMaps (Specifically the tabbed storymap), there is a function that allows you to decide which layers turn on/off depending what tab you are in while maintaining the same map extent. It would be helpful to have this same functionality in Experience Builder when switching between views. An example of our work that we would like to port to Experience Builder can be found here (Be sure to go to the hazard exposure pages to see the tabbed story map): https://napsg.maps.arcgis.com/apps/MapJournal/index.html?appid=261d020c1ec941618e6f338dd127d566 . Notice how the extent stays the same but layers turn on/off depending on what tab you are in. This functionality would cut down on development time and maintenance time would be largely reduced because we won't have to maintain as many web maps.
... View more
08-18-2020
05:55 AM
|
55
|
12
|
5808
|
IDEA
|
If this functionality exists, please let me know. I think it would be cool to have an option to jump to a section/ view that is on another or the same page, sort of like a quick link. For example, if I have a few sets of data cards at the bottom of my experience, It would be a good workflow to have a button or text at the top of the page to click on that and bring me right to that section.
... View more
08-05-2020
01:09 PM
|
12
|
3
|
1103
|
POST
|
UPDATE: A work around for this is add the data into a web map and use the pull data in Experience Builder to pull in the web map, then try it and it seems to order it correctly. The above example is pulling a feature layer itself not through a web map. Hope that helps for anyone who may stumble across this!
... View more
08-03-2020
09:40 AM
|
1
|
0
|
783
|
Title | Kudos | Posted |
---|---|---|
1 | 01-06-2023 02:17 PM | |
1 | 11-23-2022 08:36 AM | |
1 | 03-22-2022 10:10 AM | |
1 | 12-05-2022 10:41 AM | |
2 | 11-15-2022 07:48 AM |
Online Status |
Offline
|
Date Last Visited |
5 hours ago
|