POST
|
Stupid me got it, just forgot the 'f' parameter -> set to JSON in this sample. Anyway wanted to provide you my solution. token = arcpy.GetSigninToken()
url="https://myorganization.arcgis.com/sharing/rest/content/users/username/9d0a35bf33c24f289e626b51f9asdf4578/items/123456782345678itemId/update"
payload={
# THIS PARAMETER MADE THE DIFFERENCE
'f': 'json',
'description': 'Rest Test',
'overwrite': 'true',
'async': 'true',
'token': token['token'],
'title': 'RestTestFile',
'name': 'RestTestFile.csv',
'type': 'CSV',
'tags': 'RestTest',
'typeKeywords': 'CSV'}
files={
'file': ('RestTestFile.csv', open(file_path_variable,'rb'), 'text/csv')
}
# two kinds of requests with requests library
response = requests.request("POST", url, data=payload, files=files)
r = requests.post(url, data=payload, files=files)
... View more
06-21-2021
01:55 PM
|
3
|
0
|
828
|
POST
|
Hi, I need to update a csv item in an ArcGIS Online Organization. For some reasones I need to do it without using arcgis python module. The idea is basically to generate a token and update the item by using the python requests library (or urllib). Somehow I cannot make it work with the requests lib. Help is appreciated! Thanks in advance folks 🙂 token = arcpy.GetSigninToken()
url="https://myorganization.arcgis.com/sharing/rest/content/users/username/9d0a35bf33c24f289e626b51f9asdf4578/items/123456782345678itemId/update"
payload={
'description': 'Rest Test',
'overwrite': 'true',
'async': 'true',
'token': token['token'],
'title': 'RestTestFile',
'name': 'RestTestFile.csv',
'type': 'CSV',
'tags': 'RestTest',
'typeKeywords': 'CSV'}
files={
'file': ('RestTestFile.csv', open(file_path_variable,'rb'), 'text/csv')
}
# two kinds of requests with requests library
response = requests.request("POST", url, data=payload, files=files)
r = requests.post(url, data=payload, files=files)
... View more
06-21-2021
01:39 PM
|
0
|
1
|
831
|
POST
|
I have used this approach as well at some projects.
... View more
01-26-2021
02:24 AM
|
0
|
0
|
1590
|
POST
|
Just a short answer to global scope, yes I mean outside of the require statement. Have you tried to use the queryFeatures Method instead of queryObjectIds? I assume at the end of the day you want the features to be displayed in the bottom left corner. FeatureLayer | ArcGIS API for JavaScript 4.18
... View more
01-26-2021
02:21 AM
|
1
|
1
|
3117
|
POST
|
You could try to use the direct findLayerById Method of the WebMap class. Link below. WebMap | ArcGIS API for JavaScript 4.18
... View more
01-24-2021
11:45 PM
|
1
|
3
|
3146
|
POST
|
If you wanna use ArcGIS REST services you'll have to use the request class from the API which could look something like this: require([
"esri/allyourotherclasses",
"esri/request"
], function (allyourotherclasses, esriRequest, ) {
let serviceURL 'URLtoyourservice/arcgis/rest/services/MYSERVICE/gptool';
// this is the smaple data which has to be provided in unicode in the url
// ?f=json&locations=[{"routeId":"60","measure":"0"}]&outSR=102100
let request = 'f=json&locations=%5B%7B%22routeId%22%3A%2260%22%2C%22measure%22%3A%220%22%7D%5D&outSR=102100';
let myURL = serviceURL += request;
esriRequest(myURL, { responseType: 'json} ).then((response) => {
console.log(response.data);
})
}); Here is a link to the unicode converter I've used: https://www.url-encode-decode.com/ and here is the link to the ArcGIS REST API: https://developers.arcgis.com/rest/services-reference/get-started-with-the-services-directory.htm
... View more
01-24-2021
06:00 AM
|
1
|
0
|
1596
|
POST
|
Try to get your existing feature layer with the following logic (let is just another forma of declaring a variable which I personally prefer, you can as well use var). And don't get confused of (e) => { //code } it means the same as function (e) { //code } let myFeatureLayerTitle = 'TitleOfYourExistingFeatureLayer';
let myFeatureLayer = webmap.allLayers.find((layer) => {
return layer.title === myFeatureLayerTitle;
}); If you don't know the title of your layer you can also use the ID property or something else which identifies the layer. Additionally you can put the var view variable into the global scope (put it before the API require statement require([ ... ] ..... ) so you can use it in your browser dev tools and access your layers with view.map.allLayers.items
... View more
01-24-2021
05:45 AM
|
0
|
0
|
673
|
POST
|
I copied your code and tried to recreate the problem and seems like the layer is not even loading that's why your find Method returns null. I can only provide you with a development hint to put the variable view into the global scope of your JS code, which makes it available in the browser console for easier debugging. What's important is that you should not forget to put the view variable out of the global scope again, once you ship your application in production mode.
... View more
01-24-2021
05:28 AM
|
0
|
5
|
3169
|
POST
|
Hi folks, I have a MapImageLayer which sublayer symbolizes roads of a country on a map. I want to sketch a rectangle over these Roads and get the intersection points (including the routes themselves) back. So basically what I have is the MapImageLayer, which features I can also query but the only thing I get back are obviously all routes - I need to query it based on the "rectangle selection" which is currentyl sketched in a GraphicsLayer using the SketchViewModel. Thanks in advance for your help!
... View more
01-24-2021
05:17 AM
|
0
|
4
|
2029
|
POST
|
thanks, that helped a lot I only need to work on the drag and drop effect for now 🙂
... View more
12-22-2020
12:30 AM
|
1
|
2
|
1268
|
POST
|
Hi folks, I have a FeatureLayer with features which are rendered with a UniqueValueRenderer (based on their status they show on the map visualized by custom images img1 img2 or img3. This works well. I have also applied clustering successfully. Now I want to change the symbology for those features which are clustered to simply show up with a SimpleMarkerSymbol Circle and the amount of features of the cluster inside. How could I achieve this? Thanks in advance, Christian
... View more
12-22-2020
12:29 AM
|
0
|
2
|
863
|
POST
|
Hi folks, I have seen this roads and highways sample and want to recreate it by using the JS API 4.17: Drag and Drop XY Locations (esri.com) If anybody could provide some suggestions of a sufficient workflow, I'd appreciate that! Thanks in advance 🙂
... View more
12-16-2020
06:07 AM
|
0
|
4
|
1303
|
POST
|
You're welcome, allways a pleasure to help each other - nice solution with the tags!
... View more
12-16-2020
05:58 AM
|
0
|
0
|
1486
|
POST
|
Maybe you are treating it the wrong way as it is technically not a JS function, but a Promise. Here is the Doc to the fetchData Promise: PortalItem | ArcGIS API for JavaScript 4.17 Promise - JavaScript | MDN (mozilla.org) You can try the logic of the code sample below: let testPortalItem = new PortalItem({
id: "af1ad38816814b7eba3fe74a3b84412d"
});
let responseData = testPortalItem.load().then((response) => {
console.log(response);
response.fetchData().then((meep) => { console.log(meep)} ).catch((err) => { console.log(err) })
}).catch(error => {
console.log(error);
}); the default value of fetchData() is json.
... View more
12-10-2020
03:21 AM
|
3
|
2
|
1499
|
Title | Kudos | Posted |
---|---|---|
3 | 06-21-2021 01:55 PM | |
1 | 01-26-2021 02:21 AM | |
1 | 01-24-2021 06:00 AM | |
1 | 01-24-2021 11:45 PM | |
1 | 12-22-2020 12:30 AM |
Online Status |
Offline
|
Date Last Visited |
06-24-2022
07:59 AM
|