POST
|
No, per my original reply, you cannot use applyEdits to add or update attachments. applyEdits is for features. You need to use the addAttachment method to add a new attachment.
... View more
10-20-202206:22 AM
|
0
|
0
|
94
|
POST
|
I am converting an app from 4.6 to 4.20. There is code that creates a Layer for the Basemap using a custom TileInfo object. There are 349 levels of detail (LODs) in it. This code does not work AT ALL in 4.20. Is there any way to adjust it to work for 4.20? The client really likes the smaller incremented zoom compared to the map's zoom. var map = new Map({ basemap: new Basemap({ baseLayers: [ new Layer({ tileInfo: new TileInfo({ rows: 256, cols: 256, dpi: 96, format: "PNG8", compressionQuality: 0, spatialReference: new SpatialReference(4326), lods: [ new LOD({ level: -1, scale: 924464800.868618, resolution: 244500.98490512499 }), new LOD({ level: 0, scale: 9244648.868618, resolution: 2445.98490512499 }), new LOD({ level: 1, scale: 4622606.558603, resolution: 1223.06709809791 }), new LOD({ level: 2, scale: 3081925.788598, resolution: 815.427829088879 }), new LOD({ level: 3, scale: 2311585.4035955, resolution: 611.608194584365 }), new LOD({ level: 4, scale: 1849381.172594, resolution: 489.316413881657 }), new LOD({ level: 5, scale: 1541245.018593, resolution: 407.788560079851 }), new LOD({ level: 6, scale: 1321147.76573514, resolution: 349.554378792848 }), new LOD({ level: 7, scale: 1156074.82609175, resolution: 305.878742827595 }), new LOD({ level: 8, scale: 1027684.76192467, resolution: 271.908803743509 }), new LOD({ level: 9, scale: 924972.710591, resolution: 244.73285247624 }), new LOD({ level: 10, scale: 840935.577681636, resolution: 222.497983257566 }), new LOD({ level: 11, scale: 770904.6335905, resolution: 203.968925575338 }), new LOD({ level: 12, scale: 711647.680898, resolution: 188.290492151913 }), new LOD({ level: 13, scale: 660856.007161571, resolution: 174.851834931836 }), new LOD({ level: 14, scale: 616836.55659, resolution: 163.204998674435 }), new LOD({ level: 15, scale: 578319.537339875, resolution: 153.014016949209 }), new LOD({ level: 16, scale: 544333.932119176, resolution: 144.021974250481 }), new LOD({ level: 17, scale: 514124.505256333, resolution: 136.029047407166 }), new LOD({ level: 18, scale: 487095.018063263, resolution: 128.877481284201 }), new LOD({ level: 19, scale: 462768.4795895, resolution: 122.441071773532 }), new LOD({ level: 20, scale: 440758.754303714, resolution: 116.617653644832 }), new LOD({ level: 21, scale: 420749.913134818, resolution: 111.323637164195 }), new LOD({ level: 22, scale: 402480.971198, resolution: 106.489969942744 }), new LOD({ level: 23, scale: 385734.44108925, resolution: 102.059108323081 }), new LOD({ level: 24, scale: 370327.6333892, resolution: 97.9827156329904 }), new LOD({ level: 25, scale: 356105.964743, resolution: 94.2198916113687 }), new LOD({ level: 26, scale: 342937.753033556, resolution: 90.7357952950522 }), new LOD({ level: 27, scale: 330710.127874786, resolution: 87.5005630013297 }), ] }) }) ] }), });
... View more
10-19-202103:03 PM
|
0
|
0
|
260
|
POST
|
It's the addAttachment method. applyEdits is for changing features. Have you tried adding the file to body? When I used RestSharp, I had to pass the file into AddFile instead of AddParameter.
... View more
08-11-202102:08 PM
|
0
|
0
|
336
|
POST
|
我和RestSharp这样做。而不是附加token onto the end of your request URL, you add the token to the request using the AddHeader method. var client = new RestClient(baseUrl); //the url of your service var request = new RestRequest("0/applyEdits", Method.POST); request.AddHeader("Authorization", $"Bearer {token}"); //"token" is a parameter passed into the method; I left the method signature off this sample request.AddParameter("f", "json"); request.AddParameter(editsType.ToString(), jsonAdds); //"jsonAdds" is another parameter of type JSON object if (editsType == applyEditsType.adds) //"editsType" is a custom enum parameter {//allows service to create new GlobalID for adds request.AddParameter("useGlobalIds", "false"); } else {//allows updates and deletes to look for records based on GlobalID instead of OBJECTID request.AddParameter("useGlobalIds", "true"); } var response = client.Execute(request); if (response.ErrorException != null) { var gisException = new Exception("Error retrieving response. Check inner details for more info.", response.ErrorException); throw gisException; } return response.Content;
... View more
06-16-202102:47 PM
|
0
|
0
|
1463
|
POST
|
We never did figure out why these error messages were occurring. The GIS admin published a new service using the same map, but named it differently. Now it just works.
... View more
05-28-202007:15 AM
|
0
|
0
|
394
|
POST
|
我有一个REST服务that I can query the feature class, but when I try to call addAttachment, or deleteAttachments, it returns error code 500 and the message "error performing
05-14-202009:25 AM
|
0
|
1
|
422
|
POST
|
I was able to use the Add Attachment REST API call using RestSharp. I write C#, not Python, but the key for me was the AddFile method instead of AddParameter. The file itself was a byte array, and it also accepts the MIME type as an optional parameter. Otherwise, it creates the attachment with a MIME of application/octetstream. Here's my function; theMimeType function is not included - it just looks at the end of the file name to see if it's BMP, JPEG or PNG. Not elegant, but there is control elsewhere over what kind of files are submitted. public string SaveAttachment(FeatureServiceLayer resource, int objectId, string token, byte[] theImageBytes, string imageFilename) { string theContentType = theMimeType(imageFilename); var client = new RestClient(baseUrl); var request = new RestRequest(resource.ToString("D") + "/" + objectId + "/addAttachment", Method.POST); request.AddHeader("Authorization", $"Bearer {token}"); request.AddParameter("f", "json"); if (theContentType != "") { request.AddFile("attachment", theImageBytes, imageFilename, theContentType); } else { request.AddFile("attachment", theImageBytes, imageFilename); //unknown content type } var response = client.Execute(request); if (response.ErrorException != null) { var gisException = new Exception("Error retrieving response. Check inner details for more info.", response.ErrorException); throw gisException; } return response.Content; }
... View more
05-12-202007:53 AM
|
2
|
0
|
3156
|
Title | Kudos | Posted |
---|---|---|
2 | 05-12-202007:53 AM |
Online Status |
Offline
|
约会啦st Visited |
10-20-202202:24 PM
|