|
POST
|
No, I just want to allow user to "SaveAs" in IE or download into downloads directory (Chrome). However, I don't believe download attribute is supported in IE. https://stackoverflow.com/questions/46817974/download-file-from-server-response-with-url-as-json-file In any case, it still just opened a new tab and displayed the content of the .json file that was in the response instead of downloading it.
... View more
10-20-2017
01:47 PM
|
0
|
0
|
1821
|
|
POST
|
arcpy.mapping.ListLayoutElements should get you access to the title I'd think. http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-mapping/listlayoutelements.htm
... View more
10-20-2017
01:44 PM
|
1
|
2
|
5415
|
|
POST
|
This issue is likely due to missing file associations on the client. Only resolution I could arrive at is to simply return a .zip file in the response.
... View more
10-20-2017
01:27 PM
|
0
|
0
|
1821
|
|
DOC
|
From my example I posted, we noticed that some clients would not download the .json file in IE and a new browser tab would open and simply display the contents of the file. The solution is to .zip the file and return that to the client. Also, window.open() can be affected by popup blocking: executeGPDownloadSessions: function (param) {
var gp = new Geoprocessor("https://mydomain/myAGSsite/rest/services/GP/myGPServiceName/GPServer/myGPServiceTaskName");
var params = { "inputSession": param };
gp.execute(params, downloadFile);
function downloadFile(results, messages) {
//do something with the results
var theSessionFile = results[0].value;
window.open(results[0].value.url);
}
}, Instead of window.open(), add an <a href> within a <div> and then replace the href link in the JavaScript with the url that is returned from the service in the response: //working function using <a href> as means to open download interface instead of window.open()
//this is because popup blocker may affect window.open() function on some clients
function downloadFile(results, messages) {
//do something with the results
//var theSessionFile = results[0].value;
//set a var of the complete url address that is returned from the GP service request
var urlOfFile = results[0].value.url;
//get the div from the html of the widget
link = document.getElementById('downloadSession');
link.setAttribute('href', urlOfFile);
link.appendChild(document.createTextNode("Save file"));
document.body.appendChild(link);
link.click();
}
},
... View more
10-20-2017
12:47 PM
|
0
|
0
|
17824
|
|
POST
|
I have a GP service with an output parameter as type File -- a simple text file with a .json file extension on the end. In some Internet browsers (mostly Internet Explorer) it does not invoke the "Download this file?" option to the user and simply opens a new tab and displays the content of the file. Is this an IIS/server config, something with the GP service itself or perhaps even at the client I can implement to alleviate this issue? Thanks for any ideas, I'm out of them.
... View more
10-18-2017
02:15 PM
|
0
|
3
|
2246
|
|
POST
|
formatteddatetime = yourdatevalue.strftime("%Y/%m/%d")
... View more
10-18-2017
01:06 PM
|
1
|
0
|
1269
|
|
POST
|
Make sure 'SHAPE@' is being included in your scFields list.
... View more
10-18-2017
12:44 PM
|
0
|
1
|
9973
|
|
POST
|
Is this an SDE feature class? If so, have you tried a standard SQL count statement against the RBMS?
... View more
10-17-2017
07:54 AM
|
0
|
2
|
917
|
|
POST
|
Aren't you already doing that? I see you are setting up arcpy.da.SearchCursor().
... View more
10-16-2017
02:22 PM
|
0
|
0
|
3123
|
|
POST
|
if int(arcpy.GetCount_management(TheInputFeatureClass).getOutput(0))<> len(set(arcpy.da.SearchCursor(TheInputFeatureClass, 'TheFieldToEvaluate'))):
print 'length did not match'
... View more
10-16-2017
02:10 PM
|
0
|
7
|
3123
|
|
POST
|
Yep. Great point considering the OP needs this to perform during an onLoad event.
... View more
10-16-2017
02:03 PM
|
0
|
0
|
4589
|
|
POST
|
Considering Dan's valid point about numpy setup time, what about simply setting a "set" to the SearchCursor? print len(set(arcpy.da.SearchCursor(TheInputFeatureClass, 'TheFieldToEvaluate')))
... View more
10-16-2017
02:02 PM
|
0
|
9
|
4589
|
|
POST
|
import numpy as np
nparr = arcpy.da.FeatureClassToNumPyArray(TheInputFeatureClass, ['TheFieldToEvaluate'])
uniqueValueCount = len(np.unique(nparr))
print uniqueValueCount
... View more
10-16-2017
01:47 PM
|
0
|
2
|
4589
|
|
POST
|
As an alternative to the field calculator, this is a mix of libraries and ultimately simply uses a dictionary and arcpy.da.UpdateCursor to calculate the field with the repeating values. (really, I had been looking for a reason to dive into using a dictionary to update with an UpdateCursor and this was a good exercise to nail that down). import arcpy
import pandas
import numpy as np
import sys
#set the repeating values to use
repeat_arr = [1, 2, 3]
#the feature class to be updated, the field to calculat and a join field
fc = r'H:\DescribeFGDB\Readme.gdb\RptLyr'
updateField = 'calcIt'
idField = 'OBJECTID'
#convert the feature class to an array with OID values
nparr = arcpy.da.FeatureClassToNumPyArray(fc, ['OID@'])
#get array as pandas dataframe and populate the repeating values column
df = pandas.DataFrame(nparr)
df = df.join(pandas.DataFrame(repeat_arr * (len(df)/len(repeat_arr)+1), columns=['calcIt']))
#convert back to a numpyarry
x = np.array(np.rec.fromrecords(df.values))
names = df.dtypes.index.tolist()
x.dtype.names = tuple(names)
#convert to an in_memory table, set join field and the field to use to calculate with
arcpy.da.NumPyArrayToTable(x, r'in_memory\finalarr')
joinTab = r'in_memory\finalarr'
joinIdField = 'OBJECTID'
joinValueField = 'calcIt'
#create dictionary from the in_memory table
valueDic = dict ([(key, val) for key, val in arcpy.da.SearchCursor(joinTab, [joinIdField,joinValueField])])
#update the source feature class with the dictionary values, joining on the joinfields
with arcpy.da.UpdateCursor(fc, [updateField, idField]) as cursor:
for update, key in cursor:
if not key in valueDic:
continue
row = (valueDic [key], key)
cursor.updateRow(row)
del cursor
... View more
10-16-2017
12:18 PM
|
0
|
0
|
846
|
|
POST
|
import arcpy
import pandas
repeat_vals = [1, 2, 3]
df = pandas.DataFrame(range(100), columns=['col1'])
df = df.join(pandas.DataFrame(repeat_vals * (len(df)/len(repeat_vals)+1), columns=['col2']))
print df.values
... View more
10-16-2017
10:31 AM
|
0
|
0
|
846
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-17-2020 10:47 AM | |
| 1 | 10-25-2022 11:46 AM | |
| 1 | 08-08-2022 01:40 PM | |
| 1 | 02-15-2019 08:21 AM | |
| 2 | 08-14-2023 07:14 AM |
| Online Status |
Offline
|
| Date Last Visited |
01-22-2025
02:28 PM
|