POST
|
We were able to figure out what is happening and how to work around it so I'll document it here for posterity. Our SOE utilizes the IGeometryServer.FindSRbyWKID method. Our code had been passing a value of "EPSG" for the optional authority parameter. This worked fine until we upgraded to 10.3 server, when we started seeing the "Can't assign authority metadata to this spatial reference object because it is empty" error. Apparently the inclusion of a string for the authority parameter results in the method returning an empty spatial reference, even if your WKID is legit. Luckily this parameter is optional so the workaround is to simply pass an empty string ("") for this parameter and the method will work again, returning a valid spatial reference object. We went ahead and logged this as a bug with ESRI too.
... View more
01-29-2015
11:25 AM
|
0
|
0
|
295
|
POST
|
Ah ha! I found the key to the answer by applying some google-foo, wine, and much confused panic recall of algebra i thought i would never use. I'll post the answer so I become rich and famous, as all GIS old guys should do. Here is where I found the logic for the cached map scale logic: What ratio scales do Google Maps zoom levels correspond to? - Geographic Information Systems Stack Exchange and this response led to the answer: http://gis.stackexchange.com/a/81390 Many thanks to these folks as this would have been impossible for me to figure out on my own. For posterity in javascript form: alert(Math.round(Math.log(591657550.500000 /(<your map scale>/2))/Math.log(2))); This should return an integer value that corresponds to the zoom level (rounded) once you supply the scale. Try it in JsFiddle: Edit fiddle - JSFiddle Hope this helps someone else, I was lost on this one for a time and considered knitting as an alternative career. D. Ryan
... View more
12-05-2014
12:55 AM
|
3
|
1
|
2337
|
POST
|
Hello, I would like to determine how to a convert specific map scale to the closest zoom scale used by the major web mapping players. For example, I want to open a web map to whatever predefined scale is closest to 1:100,000 or whatever cached scale is closest. How do I calculate the zoom level knowing that this is the established breakdown, and that the answer that I'm looking for is 10?: 20 : 1128.497220 19 : 2256.994440 18 : 4513.988880 17 : 9027.977761 16 : 18055.955520 15 : 36111.911040 14 : 72223.822090 13 : 144447.644200 12 : 288895.288400 11 : 577790.576700 10 : 1155581.153000 9 : 2311162.307000 8 : 4622324.614000 7 : 9244649.227000 6 : 18489298.450000 5 : 36978596.910000 4 : 73957193.820000 3 : 147914387.600000 2 : 295828775.300000 1 : 591657550.500000 There must be an elegant way to do this, but my math.foo is weak after all these years of being out of school and withering away in meetings. Thanks for your help, Ryan
... View more
12-04-2014
11:56 PM
|
0
|
2
|
8549
|
POST
|
Hello, Does anyone know of a way to identify versions that are unused, perhaps by checking to see how long ago edits were made to a particular version. I'm asking because I have many versions that were created for individual users and I suspect that lots of them were never used. I'd like to get rid of the extras without having to delete every version if possible. Thank you, Ryan
... View more
06-26-2014
02:22 PM
|
0
|
2
|
475
|
POST
|
Hello, I am using version 10. I would like to export the selected features (from a FeatureLayer) from my Javascript API application and export their attributes to a csv file. Seems like it should be real easy but their is something going wrong. Thanks for your help.
... View more
12-27-2012
11:45 AM
|
0
|
0
|
479
|
POST
|
Hello, I downloaded the Table to Excel geoprocessing tool from ArcGIS Online and I would like to publish it as a geoprocessing service. My question is, how would I need to modify the script to accept an ArcGIS Javascript API FeatureSet as the input? I see that the input parameter for the script is currently set to TableView. I've changed it to be a "Feature Set" and modified the python code slightly to create the file in the Server's scratch workspace. Unfortunately, when I call the function, I get this strange error reported in the server log: updateParameters Execution Error: Runtime error : 'NoneType' object has no attribute 'lower' I am guessing that my python code does work correctly against the FeatureSet object. Anyone have any ideas? Here is my python code:
# -*- coding: utf-8 -*-
"""
This script will convert a table to an excel spreadsheet. If the third-party
module xlwt is available, it will use that. Otherwise, it will fall back to
CSV.
"""
import os
import sys
import arcpy
ver = arcpy.GetInstallInfo()['Version']
def header_and_iterator(dataset_name):
"""Returns a list of column names and an iterator over the same columns"""
data_description = arcpy.Describe(dataset_name)
fieldnames = [f.name for f in data_description.fields if f.type not in ["Geometry", "Raster", "Blob"]]
def iterator_for_feature():
if ver == u'10.0':
cursor = arcpy.SearchCursor(dataset_name)
row = cursor.next()
while row:
yield [getattr(row, col) for col in fieldnames]
row = cursor.next()
del row, cursor
else:
# leverage faster da cusors at 10.1
with arcpy.da.SearchCursor(dataset_name, fieldnames) as cursor:
for row in cursor:
yield row
return fieldnames, iterator_for_feature()
def export_to_csv(dataset, output):
"""Output the data to a CSV file"""
import csv
def _encode(x):
if isinstance(x, unicode):
return x.encode("utf-8")
else:
return str(x)
def _encodeHeader(x):
return _encode(x.replace(".","_"))
out_writer = csv.writer(open(output, 'wb'))
header, rows = header_and_iterator(dataset)
out_writer.writerow(map(_encodeHeader, header))
for row in rows:
out_writer.writerow(map(_encode, row))
def export_to_xls(dataset, output):
"""
Attempt to output to an XLS file. If xmlwt is not available, fall back
to CSV.
XLWT can be downloaded from http://pypi.python.org/pypi/xlwt"""
try:
sys.path.append(os.path.join(os.path.dirname(__file__), 'xlwt-0.7.4'))
import xlwt
except ImportError:
arcpy.AddError("failed to import xlwt module")
return
header, rows = header_and_iterator(dataset)
# Make spreadsheet
workbook = xlwt.Workbook()
worksheet = workbook.add_sheet(os.path.split(dataset)[1])
#Set up header row, freeze panes
header_style = xlwt.easyxf("font: bold on; align: horiz center")
for index, colheader in enumerate(header):
worksheet.write(0, index, colheader.replace(".","_"))
worksheet.set_panes_frozen(True)
worksheet.set_horz_split_pos(1)
worksheet.set_remove_splits(True)
# Write rows
for rowidx, row in enumerate(rows):
for colindex, col in enumerate(row):
worksheet.write(rowidx+1, colindex, col)
workbook.save(output)
if __name__ == "__main__":
dataset_name = arcpy.GetParameterAsText(0)
scratch_path = arcpy.env.scratchWorkspace
format = arcpy.GetParameterAsText(1)
if format == "CSV":
output_file = os.path.join(scratch_path,'lois_export.csv')
export_to_csv(dataset_name, output_file)
arcpy.SetParameterAsText(2,output_file)
elif format == "XLS":
try:
output_file = os.path.join(scratch_path,'lois_export.xls')
export_to_xls(dataset_name, output_file)
arcpy.SetParameterAsText(2,output_file)
except:
import traceback
arcpy.AddError(traceback.format_exc())
else:
raise ValueError("Don't know how to export to %r" % format)
Here is the javascript code that I call the service with: function extractData(oidString,fileFormat){
var query = new esri.tasks.Query();
var qt = new esri.tasks.QueryTask(localServerPath + "/LOISOracle/MapServer/0");
query.returnGeometry = false;
query.where = "ESRI_OID in (" + oidString + ")";
query.outFields = ["POINTNAME"];
qt.execute(query, function (featureSet) {
alert(featureSet.features.length);
alert(fileFormat);
var params = { "Input_Feature_Set":featureSet, "Format":fileFormat };
esri.show(loading);
gp.submitJob(params, completeCallback , statusCallback,function(error){
alert(error.message);
esri.hide(loading);
});
});
}
function completeCallback(jobInfo){
if(jobInfo.jobStatus !== "esriJobFailed"){
gp.getResultData(jobInfo.jobId,"Output_File", downloadFile);
}
}
function statusCallback(jobInfo) {
var status = jobInfo.jobStatus;
if(status === "esriJobFailed"){
alert(status);
esri.hide(loading);
}
else if (status === "esriJobSucceeded"){
esri.hide(loading);
}
}
Thanks, David
... View more
12-19-2012
02:02 PM
|
0
|
3
|
4151
|
POST
|
Hello, Does anyone know if it is possible to control the number of digits to the right of the decimal in the measurement widget results? Thanks, Ryan
... View more
11-05-2012
02:34 PM
|
0
|
1
|
415
|
POST
|
Hello, I was also having this problem whereby my featurlayer would not display in IE 9. I tried the solutions above with no success. However, setting the mode to ONDEMAND did resolve the problem for me. BTW, I was not using a proxy. David
... View more
09-20-2012
10:08 AM
|
0
|
0
|
287
|
POST
|
Oops code is too big. I have attached it to this message. David
... View more
07-27-2012
07:25 AM
|
0
|
0
|
688
|
POST
|
Hello, I wasn't having the graphics problem, but if I were, I would try that code in the init function. Also, I was able to get the tabcontainer to display itself the right way. It turns out that I had to call the tabcontainer's resize method in the poup's onShow event. I figured this using this example by Derek Swingley: http://jsfiddle.net/wKue4/12/. However, I am using point data and I almost always return more than one result feature. So everything worked fine for the first record, but when I navigate using the left and right arrows in the popup the tabcontainer was collapsing again. I couldn't just call resize again on the onSelectionChange event, because then the first record's tabcontainer collapsed again. Good grief! So I came up with this solution where I switch the selected child tab programatically and it started to work correclty. Also note that I could not assign an ID to the tabcontainer as in Derek's example because you end up in a situation with multiple dijits with the same Id and the code errors (this only occurs if your identify returns multiple results). So, instead I assigned a class to the tabcontainer so that I could get a reference to it. There is probably a better way to do all this but I'm running out of time:(. I'll post my code below.... David
... View more
07-27-2012
07:21 AM
|
0
|
0
|
688
|
POST
|
Hello, You might try this to get solve the graphic problem: dojo.connect(map.infoWindow, "onHide", function(){ map.graphics.clear(); }); David
... View more
07-26-2012
09:05 AM
|
0
|
0
|
688
|
POST
|
Sweet, thanks John! That worked for me. I am also having the problem where the tabs are collapsed. I have to click on them to make them expand vertically and show their contents. I'd appreciate it if you would let me know if you find a solution and I'll do the same. Thanks again, David
... View more
07-26-2012
07:19 AM
|
0
|
0
|
688
|
POST
|
Hello, I am having the same problem. I think they are the menu and slider features of the tab container. There are properties to turn them off, but they are not working for me. tc.useMenu=false; tc.useSlider=false; Anyone know how to make them go away? [ATTACH=CONFIG]16402[/ATTACH]
... View more
07-25-2012
04:04 PM
|
0
|
0
|
688
|
POST
|
Hello, I have a very strange issue occuring with SDE. I have a statewide roads feature class (using ST_GEOMETRY) with about 147,000 records and one level of spatial index that redraws very quickly when I first buillt it, or if I drop it and rebuild it using ArcCatalog. However, after only a few hours, if I start ArcMap and add this feature class to the dataframe it will typically take about between 3 and 8 seconds to redraw, regardless of scale. If I execute the command to rebuild the spatial index using sdetable -o rebuild_index, the dataframe will then refresh instantly or nearly instantly. However, if I leave this session of ArcMap open and start a new session adding the same dataset to the map, the drawing speed is slow in the new session, but fast in the original session. If I reexecute the rebuild index command now, both sessions will redraw instantly. Now, if I close both sessions, and start a new one the performance is slow again. I have about 20 versions that are all children of Default, and I see about 100 edits per day. I run a batch reconcile process each night followed by a compress, a rebuild on all the indexes, and an analyze on this featureclass. Also, I 'm running SDE 9.3.1 on Oracle 10.2.0.3. I'm connecting through the SDE, although I have confirmed that the same problem occurs using direct-connect. Any help would be greatly appreciated as this one has me stumped. Thanks, David
... View more
03-22-2012
08:40 AM
|
0
|
0
|
186
|
Title | Kudos | Posted |
---|---|---|
3 | 12-05-2014 12:55 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|