|
POST
|
Have you tried another way to do it? If you like, you can try copying the items: https://developers.arcgis.com/python/sample-notebooks/clone-portal-users-groups-and-content/#Copy-Items The above script might give you more granular control over the whole process when compared to clone_items. I cloned my whole portal into a staging environment using 4 python scripts (copy the users, groups, items and reconstruct the relationships).
... View more
04-07-2019
07:51 PM
|
0
|
0
|
1819
|
|
DOC
|
Great widget! Solid and elegant code, love it. Hat off to the programmer. It supports graphics, added layers, and not only layer visibility but also layer order! and you can expand this widget easily. I has been and will be relevant till the out-of-box Bookmark widget has the same functionality, which seems unlikely given it's been more than 3 years
... View more
03-31-2019
06:24 PM
|
1
|
0
|
17368
|
|
DOC
|
Hi John, This is an problem. It seems the LayerInfos is not updated completely when setLayerOnMap function gets called. Without knowing too much about the details on how the LayerInfos are updated (the architecture of whole jimu library is not clearly documented!) , I simply recreated the whole LayerInfos instance when all the layers are loaded. I also created my own version of SetLayersOnMap function which returns a promise. I am happy to share the code here: _loadSession: function (sessionToLoad) {
// zoom the map
if (sessionToLoad.extent) {
extentToLoad = new Extent(sessionToLoad.extent);
this.map.setExtent(extentToLoad).then(function () {
console.log('SaveSession :: loadSession :: new extent = ', extentToLoad);
}, function () {
var msg = new Message({
message: string.substitute("An error occurred zooming to the ${name} map.", sessionToLoad),
type: 'error'
});
});
}
// load the saved graphics
this.setGraphicsOnCurrentMap(sessionToLoad.graphics);
// toggle layers
if (sessionToLoad.layers) {
//this.setLayersOnMap(sessionToLoad.layers);
theWidget = this;
//make sure all the added layers are loaded before retrieving the new layerInfos,
//replace the current layerInfos with the new layerInfos, this will make sure the layerlist will
//alwas show the correct layers and sublayers of the added layer
this.mySetLayersOnMap(sessionToLoad.layers).then(function(flags){
newLayerInfos = LayerInfos.createInstance(theWidget.map);
LayerInfos.setInstance(theWidget.map,newLayerInfos);
//update the layerlist?
theWidget.layerInfosRestoreState(sessionToLoad.layerOptions);
});
}
// fire custom event
topic.publish("SaveSession/SessionLoaded", sessionToLoad);
console.log('SaveSession :: loadSession :: session = ', sessionToLoad);
},
mySetLayersOnMap: function (settings) {
//var allDynamicLayersReadyDefs = new Deferred();
var layersLoadedDefs = [];
//var layerLoadedFlag;
var layer;
array.forEach(settings, lang.hitch(this,function(layerSettings) {
layer = this.map.getLayer(layerSettings.id);
if (!layer) {
layer = this.addLayerToMap(layerSettings);
layer._layerLoadedFlag = new Deferred();
layersLoadedDefs.push(layer._layerLoadedFlag);
layer.on("load",function(e){
e.layer._layerLoadedFlag.resolve("loaded!");
delete e.layer._layerLoadedFlag;//it seems that deleting the temprary property here won't affect the Deferred. by simoxu
});
}
}));
return all(layersLoadedDefs).then(function(flags){
return flags;
});
}, Hope it helps. I'll see if I can contribute to the widget project in GitHub, so that this small fix can be merged into the product.
... View more
03-31-2019
06:01 PM
|
1
|
0
|
17368
|
|
POST
|
David Vitale Thank you for your attention to this issue. We left all CORs settings in our portal and ArcGIS Servers to the default value, and according to ESRI document, the default settings should allow CORs. I also tried to serve the notebook over https (using a self-signed certificate), but the warning on the map widget remains. plus, I can't add any hosted feature layer to the map widget either. and I am not sure if these symptoms are linked back to the same cause. Despite our setting is IWA authentication, ESRI support suggests me explicitly login my portal using my username and password like this due to a bug. dcsiportal=GIS(url="https://portal_url",username="simo@DomainName") This allows me to access the data in the private hosted feature layers, but these layers still can't be added to the map widget. Thanks
... View more
03-12-2019
10:20 PM
|
1
|
2
|
5176
|
|
POST
|
I feel the different API version may behave slightly differently on different GIS platform version. My case is quite opposite. flc.manager.update_definition({"capabilities":"Create,Delete,Query,Update,Editing,Sync"}) works, but flc.manager.update_definition({"syncEnabled":True}) doesn't. My version is portal 10.6.1, API 1.5.3
... View more
03-07-2019
06:30 PM
|
0
|
0
|
3660
|
|
POST
|
No worries Joel, I am glad it helped. could you please promote the answer by marking it as the correct answer so that it might also help others with the same question.Cheers.
... View more
03-07-2019
04:42 PM
|
0
|
0
|
1536
|
|
POST
|
Hi Joel, You don't have to explicitly project all the coordinates. the query function can do it for you when you specify out_sr parameter. Are you trying to get a JSON representation of the layer? I am asking because you didn't specify the out_fields, the default value is "*" which returns all fields. if this is what you want, it's straightforward to get the JSON representation: fset = flayer.query(out_sr=4326)
josn_fset = fset.tojson If you only want to cherry-pick some information from features in the layer, then get the dict representation and manipulate the dict before converting it to the json format import json
dict_fset = fset.to_dict()
# do something on the dict_fset
josn.dumps(dict_fset) Also, you can format the code in your post and make it easy to read, that will increase the change for you to get a correct answer. As we all know, indentation in Python is like { and } in some other languages like Javascript, C/C#, Java etc, formatting (white spaces) is actually essential. In you code, it seems you performing a projection for every coordinates (you can have tens of thousands of coordinates if polygon or polylines are involved), that's why it's excruciatingly slow.
... View more
03-06-2019
03:54 PM
|
2
|
2
|
1536
|
|
POST
|
I was told the error 499 is related to a bug: #BUG-000109779 ArcGIS API for Python is unable to access hosted feature layers in Portal with Integrated Windows Authentication configured, unless the layer is shared with 'Everyone' The error message in the map is a separate issue, although it is related to authentication also.
... View more
03-05-2019
02:08 PM
|
1
|
4
|
5176
|
|
POST
|
Hi Rohit, I have the same issue. As you suggested, I use don't use username and password when connecting to my portal. Interestingly, I only have this issue with hosted feature services (not shared, but I am the owner with administrator privilege), if the service is shared to everyone or not hosted, no issues. so what's the possible cause? Thanks.
... View more
02-28-2019
06:14 PM
|
0
|
0
|
2429
|
|
POST
|
I still have this issue, and I am also getting the following Error when trying to create a FeatureLayerCollection: ---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\__init__.py in _hydrate(self)
8994
-> 8995 self._refresh()
8996
~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\__init__.py in _refresh(self)
8961 else:
-> 8962 dictdata = self._con.post(self.url, params, token=self._lazy_token)
8963
~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\_impl\connection.py in post(self, path, postdata, files, ssl, compress, is_retry, use_ordered_dict, add_token, verify_cert, token, try_json, out_folder, file_name, force_bytes, add_headers)
1158
-> 1159 self._handle_json_error(resp_json['error'], errorcode)
1160 return None
~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\_impl\connection.py in _handle_json_error(self, error, errorcode)
1179 errormessage = errormessage + "\n(Error Code: " + str(errorcode) +")"
-> 1180 raise RuntimeError(errormessage)
1181
RuntimeError: Token Required
(Error Code: 499)
During handling of the above exception, another exception occurred:
RuntimeError Traceback (most recent call last)
~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\__init__.py in _hydrate(self)
9003 self._lazy_token = None
-> 9004 self._refresh()
9005
~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\__init__.py in _refresh(self)
8961 else:
-> 8962 dictdata = self._con.post(self.url, params, token=self._lazy_token)
8963
~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\_impl\connection.py in post(self, path, postdata, files, ssl, compress, is_retry, use_ordered_dict, add_token, verify_cert, token, try_json, out_folder, file_name, force_bytes, add_headers)
1158
-> 1159 self._handle_json_error(resp_json['error'], errorcode)
1160 return None
~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\_impl\connection.py in _handle_json_error(self, error, errorcode)
1179 errormessage = errormessage + "\n(Error Code: " + str(errorcode) +")"
-> 1180 raise RuntimeError(errormessage)
1181
RuntimeError: Token Required
(Error Code: 499)
During handling of the above exception, another exception occurred:
RuntimeError Traceback (most recent call last)
<ipython-input-20-d415c0042ac8> in <module>
----> 1 flc = FeatureLayerCollection.fromitem(disrupt_tenancies1617)
~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\__init__.py in fromitem(cls, item)
8952 if not item.type.lower().endswith('service'):
8953 raise TypeError("item must be a type of service, not " + item.type)
-> 8954 return cls(item.url, item._gis)
8955
8956 def _refresh(self):
~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\features\layer.py in __init__(self, url, gis)
1519
1520 try:
-> 1521 if self.properties.syncEnabled:
1522 self.replicas = SyncManager(self)
1523 except AttributeError:
~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\__init__.py in properties(self)
8970 return self._lazy_properties
8971 else:
-> 8972 self._hydrate()
8973 return self._lazy_properties
8974
~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\__init__.py in _hydrate(self)
9011 # try token in the provided gis
9012 self._lazy_token = self._con.token
-> 9013 self._refresh()
9014
9015 if err is not None:
~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\gis\__init__.py in _refresh(self)
8960 dictdata = self._con.get(self.url, params, token=self._lazy_token)
8961 else:
-> 8962 dictdata = self._con.post(self.url, params, token=self._lazy_token)
8963
8964 self._lazy_properties = PropertyMap(dictdata)
~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\_impl\connection.py in post(self, path, postdata, files, ssl, compress, is_retry, use_ordered_dict, add_token, verify_cert, token, try_json, out_folder, file_name, force_bytes, add_headers)
1157 verify_cert=verify_cert, is_retry=True)
1158
-> 1159 self._handle_json_error(resp_json['error'], errorcode)
1160 return None
1161
~\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\lib\site-packages\arcgis\_impl\connection.py in _handle_json_error(self, error, errorcode)
1178
1179 errormessage = errormessage + "\n(Error Code: " + str(errorcode) +")"
-> 1180 raise RuntimeError(errormessage)
1181
1182 class _StrictURLopener(request.FancyURLopener):
RuntimeError: Token Required
(Error Code: 499) and I can't get layers or tables for hosted Feature Service. It will be really good if I can get a hint from one of the API insiders Rohit Singh David Vitale
... View more
02-28-2019
05:13 PM
|
1
|
5
|
5176
|
|
POST
|
There are multiple ways to do it. You can create a replica or do a query then use pandas dataframe to export the result to a CSV file. Please try if the following code works: import arcgis
from arcgis.gis import GIS
gis = GIS("https://arcgis.com", "User", "Password")
from arcgis.gis import *
import os
icy_conditions = gis.content.get('a6be839d462d4441802abad0728cc857')
icy_layers = icy_conditions.layers
icy_reports = icy_layers[0]
Status_query = icy_reports.query(where="Status='Cleared'")
# use pandas dataframe to export the data into csv
# you have chance to reshape your data, for example, which fields to be exported
sdf_temp = Status_query.sdf
# specify the fields you want to export if needed
#refined_sdf = sdf_temp[["field1","fields",...]]
# save to a csv file in a particular folder
sdf_temp.to_csv(r'c:\temp\xyz.csv')
# delete features permantly, use with great causion!!
#icy_reports.delete_features(where="Status='Cleared'") delete_features function is very powerful, but very dangerous. make sure you backup your data before deleting any records, here is the doc: arcgis.features module — arcgis 1.5.3 documentation Hope it helps
... View more
02-26-2019
05:55 PM
|
0
|
0
|
1758
|
|
POST
|
Hello folks Have you seen this annoying message when displaying a map in the Jupyter Lab/notebook: In the browser console: My GIS environment is ArcGIS Portal 10.6 with federated ArcGIS servers, IWA authentication. If I connect to AGOL, there will be no warnings. So I think my jupyter environment should be fine, it's on the GIS side... All advises and comments are welcome
... View more
02-25-2019
04:54 PM
|
1
|
8
|
5779
|
|
POST
|
Hi Jonathan, "Python Exception" actually is under Debug->Windows-->Exception Settings In my post I said it was under Debug-->Options, that was wrong. sorry for that. If you want to know more about the Python Exception in VS2017, here is a link: Debug Python code - Visual Studio | Microsoft Docs >>>> update: I'll mark this as the correct answer for now, as it works for me. This can always be re-viewed and changed, when a better answer emerges. Thanks to all.
... View more
02-25-2019
04:06 PM
|
2
|
0
|
5636
|
|
POST
|
I don't think the map widget can be displayed outside of IPython and Jupyter environment. I normally develop relatively complicated code in my IDE and paste it back in notebook to see the visual effects. but I am no IPython widget expert, and not clear about the mechanism that are being used in displaying the widgets, I can only imagine the widgets are represented as a bundle of JS and HTML in the browser so that I can be displayed.
... View more
02-24-2019
05:44 PM
|
0
|
1
|
1383
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-28-2019 05:13 PM | |
| 1 | 02-25-2019 04:54 PM | |
| 1 | 03-05-2019 02:08 PM | |
| 1 | 03-12-2019 10:20 PM | |
| 1 | 11-27-2024 04:36 AM |
| Online Status |
Offline
|
| Date Last Visited |
01-17-2025
07:39 AM
|