POST
|
Hi Atma, Thanks for the tip! I hadn't worked with the API in a while and didn't realize I could work with the WebMap object directly. We are experiencing strange behaviour with the update() function: when calling cloned_webmap.update() with no parameters, the urls are not updated in the webmap. When I give a dictionary of item_properties as a first argument, then the urls are updated but the properties (ie title, name, description, tags...) are not updated. I have also tried the same properties with .save() which I would expect to create a new WebMap but it seems nothing is happening. Another thing we tried is changing the properties directly such as cloned_WebMap_item.title = webMapTitle and then ran update() again, but that also made no difference... here's the code snippet: web_map_properties = { "title": "Test WebMap", "description": "Test WebMap description", "tags": "Calculation, Result" } cloned_webmap.update(web_map_properties) cloned_WebMap_item.title = "Test WebMap" cloned_webmap.update(web_map_properties) Do you have any suggestions or notice what I am doing wrong? Thank you again for your help!
... View more
04-27-2018
03:01 AM
|
0
|
1
|
667
|
POST
|
Hi Jake, Thanks for your suggestion and for providing your code! It looks well implemented and I'm sure I'll be able to use some of the logic for future projects. But in this case, since we are receiving a zip with multiple shapes from the file server, we would have to download and unzip the files anyway before running them through your script so since we've decided to simply use arcpy.merge_management() on them before zipping them again and using the API as in my code above to publish a single HFS. That workflow runs very fast and setting up cleanup was very easy. May be a little old school but it works fine! Thanks again!
... View more
04-27-2018
02:13 AM
|
0
|
0
|
612
|
POST
|
Hello Atma, A year after solving this issue, I am in the situation where I need to update the urls in a WebMap and cannot find a good way to do it. I am using the Python API 1.4 but have not found any way to update an Item or a WebMap contents via Json, and do not understand what Charlie (user cwarewa) meant by "I then read that into the web map object for the new web map and now the features show up." I tried getting the json contents from a template web map with 'get_data()' as you described here, and the used the updated json for the itemdict parameter on a new Item object in addition to the itemid of a newly created, empty WebMap but the map remained empty. As far as I can see, the update function on the WebMap object is only for updating the item info and metadata, is that correct? I also tried using the rest endpoint "update" as explained in this GeoNet question and in the Docs but I get an error with the message "Item does not exist or is inaccessible" every time. Here's the section of code where I want to update the urls in the WebMap (token is created using same portal and credentials as the target_gis object): # clone the template webmap
template_WebMap = source_gis.content.get(templateWebMapId)
result_WebMaps = target_gis.content.clone_items([template_WebMap], copy_data=False)
# get contents and update urls
result_WebMap = getResultWebMap(result_WebMaps)
webMap_content = result_WebMap.get_data()
updated_WebMap_content = updateWebMapContent(webMap_content, new_hosted_service_url)
# prepare call to upload rest endpoint
update_url = "{}/sharing/rest/content/users/{}/items/{}/update".format(
portalUrl, target_gis.users.me.orgId, result_WebMap.id)
update_params = {
'text': json.dumps(updated_WebMap_content),
'token': token,
'f': 'json'
}
update_response = urlopen(update_url, bytes(urlencode(update_params), 'utf-8'))
update_ouput = json.loads(update_response.read().decode("utf-8"))
# update_output = {'error': {'code': 400, 'message': 'Item does not exist or is inaccessible.',
# 'messageCode': 'CONT_0001', 'details': []}} So I am currently unable to update the map's contents in any way. Is there a preferred workflow for making updates to the Urls in the layers of a WebMap using the Python API? Thanks in advance, Daniel
... View more
04-24-2018
06:58 AM
|
0
|
3
|
2330
|
POST
|
I have a script tool using the Python API that receives a list of Urls to zip files on a server with multiple shape files inside. Each zip file contains exactly the same number of shapefiles with the same names and schemas. I would like to publish all the shapefiles to a single Hosted Feature Service in Portal but I cannot find any way to publish multiple files together or to merge the shapefiles or Hosted Feature Services once created. Is there a supported workflow for doing this? At the moment I am doing this to end up with one Hosted Feature Service per shapefile: for zip_Url in zip_Url_List:
shp_file = gis.content.add(item_Properties, zip_Url)
published_service = shp_file.publish()
shp_file.delete() I found the function append() on a Feature Layer in the API documentation but it seems this is only available for AGOL. The only workaround I can see is to download all the shapefiles locally, unzip them, merge the shapes with same names using arcpy, zip them again, add the shapefiles, and publish the services but this would add potentially very long processing times since some of the shapefiles can be quite big. This tool is meant to run on a button click in a web application so performance is important to not keep the user waiting any longer than necessary. Thank you in advance for any recommendations
... View more
04-18-2018
02:43 AM
|
0
|
2
|
876
|
POST
|
Hi everyone, I had the same problem but only with Web AppBuilder 2.0 Developer version. The CPU on my dev environment was maxed out (90-100%) anytime I had any apps open from the WAB and everything on the computer ran very slowly. I also installed node.js manually and copied the .exe into the server folder of my WAB2.0 directory and changed the name to node_x64.exe which is what the WAB looks for when it starts. Now the CPU usage is much better than before (30-60% depending on how many apps are running, and especially with 3D) but still generally higher than with older versions of the WAB. Just as info in case anyone else has the same problem. Best regards
... View more
04-19-2016
05:22 AM
|
1
|
7
|
952
|
POST
|
Hi Chris, Thanks for your reply. Do you have any recommendations on where to find other samples or widgets besides the GitHub repo mentioned in the question and the WPF Repo? We are having problems specifically with the bar chart functionality both with dojox and d3.js and would like to see a very similar example if possible. Thanks again, Daniel
... View more
04-04-2016
05:14 AM
|
0
|
1
|
367
|
POST
|
We been working on developing extensions for Operations Dashboard 10.3.2 with JavaScript which we have found to be generally straight-forward for simple widgets built from scratch following the samples on gitHub. A client has asked us to extend the functionality of the standard widget Bar Diagram and to do so, we want to use the code from the Bar Diagram widget as a base. However since the current version of OpDashboard is built with the ArcGIS Runtime SDK for WPF, we do not have access to the JavaScript widget’s code. The idea is to use the widget right away in the browser version of OpDashboard with Portal for ArcGIS 10.4 and also in the next release (OpD 10.4?) in the coming months. We want to avoid trying to “reinvent the wheel” by writing a new widget from scratch to do almost the same thing as the Bar Diagram widget already does and we need a quick solution to be able to deploy mid-April. The question is, is there a recommended workflow for extending standard widgets using JavaScript? Thank you in advance for your help, Daniel
... View more
03-18-2016
10:11 AM
|
0
|
0
|
1328
|
POST
|
We been working on developing extensions for Operations Dashboard 10.3.2 with JavaScript which we have found to be generally straight-forward for simple widgets built from scratch following the samples on gitHub. A client has asked us to extend the functionality of the standard widget Bar Diagram and to do so, we want to use the code from the Bar Diagram widget as a base. However since the current version of OpDashboard is built with the ArcGIS Runtime SDK for WPF, we do not have access to the JavaScript widget’s code. The idea is to use the widget right away in the browser version of OpDashboard with Portal for ArcGIS 10.4 and also in the next release (OpD 10.4?) in the coming months. We want to avoid trying to “reinvent the wheel” by writing a new widget from scratch to do almost the same thing as the Bar Diagram widget already does and we need a quick solution to be able to deploy mid-April. The question is, is there a recommended workflow for extending standard widgets using JavaScript? Thank you in advance for your help, Daniel
... View more
03-18-2016
09:58 AM
|
0
|
3
|
4566
|
Title | Kudos | Posted |
---|---|---|
1 | 04-19-2016 05:22 AM |
Online Status |
Offline
|
Date Last Visited |
01-13-2023
09:40 PM
|