POST
|
Portal and AGOL use Elasticsearch under the hood to store item metadata. It’s meant to do fast full text searches and returns ‘hits’. Don’t expect exact searches. Put more conditions to your query. Limit to your organization by passing an orgid or to a user. Drop max_items to 1 too.
... View more
05-12-2020
03:35 PM
|
0
|
0
|
4791
|
POST
|
This is your web browser basically acting as designed: you can load your app from domain1 and reach out to domain2. It’s a security thing.. To temporarily disable such behavior, just to see that your code works, you can use chrome by running it from the command line like this: chrome.exe —disable-web-security —user-data-dir=c:\temp then open your app. For a more permanent solution you need to configure your web server where your app is deployed to allow cors. There is also the proxy option, where you place a proxy app on the server to route all calls; that way your client only talks to your webserver so you avoid cors altogether.
... View more
05-12-2020
03:27 PM
|
0
|
0
|
626
|
POST
|
a featurecollection would be the closest to your case. look at the upload_format of the append method. You would need to get a featurecollection out of one of the layers of your hosted feature service If you run into any issues let me know and I’ll write a working code for you but tomorrow because it’s a bit late where I am
... View more
04-02-2020
11:30 AM
|
0
|
0
|
2064
|
POST
|
Rohit’s answer is very comprehensive and the solution to use named user from the agol store is appropriate but just in case you wanted to run the script as the actual end use, one way is to bypass the problem you are facing by: 1. Use a web workflow first through the JS API to authenticate the end user with OAuth Federated identity and grab the user token 2. Pass that token down (through a secured web service) to your python script and create the GIS object using token auth Obviously the token has an expiry time. Also, the web service above should be secure and posted on https. I’ve used this before successfully. Good luck.
... View more
04-02-2020
10:52 AM
|
1
|
0
|
4977
|
POST
|
Sure but also pay attention to the item_id parameter to the append method. It’s expecting a certain type of portal item, I.e. an uploaded file: shapefile, geojson etc.
... View more
04-02-2020
10:37 AM
|
0
|
0
|
2064
|
POST
|
So you are assuming all users have logged in at least once? What would happen to your print function if the lastlogin date is null? I would split the calls and validate that dates returned are valid dates before printing. Good luck
... View more
04-02-2020
10:33 AM
|
0
|
0
|
616
|
POST
|
Yes. The documentation is not great. Your best option to learn this API is to debug heavily using a good IDE and browse the objects. For an even better understanding you should 'step in’ the debugger into the API the scripts themselves. Esri should really revamp efforts to improve documention on this API. Even the samples they provide are stale and old.
... View more
04-02-2020
10:16 AM
|
2
|
2
|
1263
|
POST
|
well, your flayer is undeclared! To clarify the proper workflow of what you are trying to do: 1. First get the hosted feature service containing the layer you want to update/append, like this FS=gis.content.get('itemID here') 2. Get the layer like this FL=FS[0] or whatever index/name you have 3. Get the item id of the AGOL item containing source data (could be a shapefile or whatever you have previously uploaded. I am assuming a geojson file) agolId=gis.content.get('itemID here') 4. Now attempt to append like this: ret=FL.append(item_id=agolId, upsert=false, update_geometry=true, upload_format='geojson') 5. Optionally you should check the ret variable to see if success or failire Finally, fields should match between source and dest. If not, you can make use of the field_mappings prop of the append method Good luck and check append doc below arcgis.features module — arcgis 1.8.0 documentation
... View more
04-02-2020
08:22 AM
|
0
|
2
|
2064
|
POST
|
Using ArcGIS for Python API #Get a feature service out of your hosted feature service item fs = AGOLConnection.content.get('your feature service item id') #Get the table you are interested in. Assuming first one myTable = fs.ltabless[0] #declare empty array to hold edits fEdits = [] #Now iterate from source data/rows and fill an array with edits for index, row in mySourceFeatureSet.iterrows(): fEdit = { "attributes": { "ObjectID": row.ObjectId, "myField1": row.Field1, "myField2": row.Field2 } } fEdits.append(fEdit) #now apply adds. If you want Edits then use (updates=fEdits) ret = myFeatureSet.edit_features(adds=fEdits) #ideally you should inspect the 'ret' object because it will tell you if success / failure
... View more
04-02-2020
07:55 AM
|
1
|
2
|
6604
|
POST
|
I'm using ArcGIS JS 4.14 and querying AGOL for items under my organization. portal.load().then(function() { var queryParams = new PortalQueryParams({ query: 'owner:"' + portal.user.username + '" orgid:' + portal.id + ' (type:("Web Map" OR "Web Mapping Application"))', sortField: "modified", sortOrder: "desc", num: 100, extent: view.extent }); This works fine as it returns the portal items. However I'm not interested in the individual items but rather on counts (aggregations) around tags and types, as actually supported by underlying REST API: Search—ArcGIS REST API: Users, groups, and content | ArcGIS for Developers So I'm really interested to doing something like this in the JS code: portal.load().then(function() { var queryParams = new PortalQueryParams({ query: "owner:" + portal.user.username, countField: 'tags', countSize: 200, num: 0 }); Except, the PortalQueryParams does not seem to pass those properties down to the underlying dojo libraries.. PortalQueryParams | ArcGIS API for JavaScript 4.14 Am I missing something or is this not supported by the current iteration of JS API? Same thing is available in other APIs, like the ArcGIS for Python API. At this point I'm left with hitting the REST endpoint directly by composing the search strings. Not great. Any recommendations? .. I wish Esri would open up access to the underlying Elasticsearch engine they use for Portal or AGOL. Current API is crippled in this respect. Thanks in advance for any future replies.
... View more
04-02-2020
07:35 AM
|
1
|
0
|
435
|
POST
|
James, this is already solved with ArcGIS for Python version >1.4. Here is my answer to a similar questions: "Actually David and all, this has already been resolved starting with ArcGIS for Python version 1.4. Make sure you have updated to this or latest 1.5 version. The GIS class has been extended to take a token as part of the kwargs optional keyword arguments. Code below assumes connecting to arcgis.com and uses a token (it will also connect to your organizational account in agol). AGOLConnection = GIS(token=agolToken) if you wanted to connect to your own portal then provide the url parameter."
... View more
09-18-2018
05:33 AM
|
0
|
0
|
908
|
POST
|
...and last note: Esri’s documentation makes it look like there is either built in or enterprise identity stores in Portal. In fact built in is always present. You can continue to keep a mix of users from each store (not much sense from a business perspective but technically possible). Built in users need to connect directly to Portal on port 7443 while enterprise users should go through the web adaptor for SSO. Frankly Portal can pull users from three locations: built in, LDAP or SAML stores. All three can be operational at the same time.
... View more
09-12-2018
04:27 PM
|
1
|
0
|
3219
|
POST
|
Hi David, Regarding your question about support for Enterprise Logins (i.e. enterprise identity stores served through LDAP providers like AD or SAML providers like ADFS), I think when those are used, token authentication does not happen between the client application and the Portal but between the proxy and the Portal. Don’t get me wrong, the Portal only understands ‘tokeneze’ language when authenticating requests to secure items, however in the configuration above (just like when you use a web adaptor and IWA with ArcGIS Server), the proxy in front of your app (i.e. Web Adaptor) establishes the connection with the Portal using tokens while your user is authenticated at the proxy level say using IWA (this is also known as web tier authentication). So client app requests secure Portal content using the Web Adaptor URL, passing the user principal from AD. The WA authenticates with AD, then proxies the request to the Portal URL (switching port to 7443 and appending the admin token). No token is issued to your client. Long story short, for Enterprise Logins your python app does not need to pass a token or a user + pass. If things are configured correctly (i.e. Single Sign On works), the only thing needed is the URL parameter like this: myGIS = GIS(url=‘myPortal.com/home’) Hope that made sense. In any case, with these things verify first, trust later. ...yes Esri listened this once. Also, they are soon going to allow creating admin connections from Pro to AGS which is not currently possible and is a slap in the face for all customers that bought core-based AGS licenses. Progress of a kind.
... View more
09-12-2018
04:20 PM
|
1
|
1
|
3219
|
POST
|
Actually David and all, this has already been resolved starting with ArcGIS for Python version 1.4. Make sure you have updated to this or latest 1.5 version. The GIS class has been extended to take a token as part of the kwargs optional keyword arguments. arcgis.gis module — arcgis 1.5.0 documentation Code below assumes connecting to arcgis.com and uses a token (it will also connect to your organizational account in agol). AGOLConnection = GIS(token=agolToken) if you wanted to connect to your own portal then provide the url parameter. This is resolve now.
... View more
09-12-2018
01:14 PM
|
1
|
3
|
10034
|
POST
|
I had a similar question posted in 2017. I had a JS app that did SAML user login into AGOL and received a token. I wanted to pass that token to a Python module (using ArcGIS API for Python). At the time the only suggestion I was given was to hack it: from arcgis.gis import GIS my_gis = GIS() con = my_gis._con con._token = mytoken my_gis._url = 'https://myorg.maps.arcgis.com' con._url = 'https://myorg.maps.arcgis.com' Frankly I never got this to work. Only recently, my questions was answered and I was referred to the latest API which now includes a kwargs section in the GIS object that lets you specify a token if user/pass is empty. arcgis.gis module — arcgis 1.4.0 documentation There seem to be no samples provided so I just tried: my_gis = GIS(url='https://myorg.maps.arcgis.com', token='mytokenvalue') No luck still.
... View more
04-20-2018
01:51 AM
|
0
|
1
|
6818
|
Title | Kudos | Posted |
---|---|---|
1 | 04-02-2020 10:52 AM | |
1 | 09-12-2018 01:14 PM | |
1 | 09-12-2018 04:20 PM | |
1 | 09-12-2018 04:27 PM | |
1 | 04-02-2020 07:35 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:25 AM
|