|
POST
|
Jake: 3 more questions 1.) Do I need a special driver for an Oracle connection with pyodbc? 2.) What is the syntax difference for Oracle in the line cnxn = pyodbc.connect('Driver={SQL Server Native Client 11.0};UID=gis;PWD=gis;SERVER=sdeserver;DATABASE=db;')? an example would be great 3.) What is the syntax for getting the number of records counted so I know the python script actually selected records? Thank you 1. Yes, you will need an Oracle driver. I believe you can download one from here if you do not have one: http://www.oracle.com/technetwork/topics/winsoft-085727.html 2. Here is an example using DSN that is set up through Microsoft's ODBC Data Source Administrator: http://stackoverflow.com/questions/10586361/how-do-i-connect-to-oracle-10-from-pyodbc 3. You can return the record count with the following: SELECT COUNT(*) FROM table_name;
... View more
09-10-2013
10:26 AM
|
0
|
0
|
1873
|
|
POST
|
Chris, I believe I was assisting your before. I think the title of the axis's being lowercase is a bug. I was able to reproduce this same behavior. I would recommend following up with Tech Support. As for the title, you can use the 'getValue' method to retrieve the value of your field. Ex: import arcpy from arcpy import env env.overwriteOutput = 1 env.workspace = r"C:\temp\data.gdb" table = "Meters" fields = ["METER_NUMBER"] list = [] rows = arcpy.SearchCursor(table) for row in rows: list.append(row.METER_NUMBER) del row, rows #remove duplicates from list list = dict.fromkeys(list) list = list.keys() for n in list: arcpy.TableSelect_analysis(table, r"in_memory\table_sel", "METER_NUMBER = " + str(n)) #get TWACs_Number value for row in arcpy.SearchCursor(r"in_memory\table_sel"): TWACs_Number = row.getValue("TWACs_Number") out_graph_name = n out_graph_pdf = r"C:\Temp" + "\\" + str(n) + ".pdf" input_template = r"C:\Temp\KW Demand.grf" input_data = r"in_memory\table_sel" # Create the graph graph = arcpy.Graph() # Add a vertical bar series to the graph graph.addSeriesBarVertical(input_data, "KW_DEMAND") # Specify the title of the left axis graph.graphAxis[0].title = "KW Demand" # Specify the title of the bottom axis graph.graphAxis[2].title = "Meter Number" # Specify the title of the Graph graph.graphPropsGeneral.title = TWACs_Number # Output a graph, which is created in-memory arcpy.MakeGraph_management(input_template, graph, out_graph_name) # Save the graph as a PDF arcpy.SaveGraph_management(out_graph_name, out_graph_pdf, "MAINTAIN_ASPECT_RATIO", 600, 375)
... View more
09-10-2013
09:41 AM
|
0
|
0
|
1593
|
|
POST
|
Jake: Can you post the code for the quick tests you did to compare ArcSDESQLExecute function using the arcpy library vs the pyodbc library? import pyodbc, time, arcpy
startTime = time.clock()
sde_conn = arcpy.ArcSDESQLExecute(r"Database Connections\SQLSERVER.sde")
sql = "select OBJECTID, FEATURE, P_ST_NO, P_ST_NAME, P_ST_TYPE, P_CITY, P_Z_1 from AddressPoints"
sde_return = sde_conn.execute(sql)
endTime = time.clock()
elapsedTime = endTime - startTime
print elapsedTime
startTime = time.clock()
cnxn = pyodbc.connect('Driver={SQL Server Native Client 11.0};UID=gis;PWD=gis;SERVER=sdeserver;DATABASE=db;')
cursor=cnxn.cursor()
cursor.execute("select OBJECTID, FEATURE, P_ST_NO, P_ST_NAME, P_ST_TYPE, P_CITY, P_Z_1 from AddressPoints")
rows = cursor.fetchall()
cursor.close()
cnxn.close()
endTime = time.clock()
elapsedTime = endTime - startTime
print elapsedTime
... View more
09-10-2013
07:46 AM
|
0
|
0
|
1873
|
|
POST
|
I'm not sure what would be faster as I've never really worked with ArcObjects Java API. The easiest way to find out is to perform a quick simple test and compare the two. As for the ArcSDESQLExecute function, you may want to try the pyodbc library. After a quick test, this seems to perform slightly faster.
... View more
09-10-2013
05:41 AM
|
0
|
0
|
1873
|
|
POST
|
Hi Carola, I would recommend using a Mosaic Dataset rather than a raster catalog. Mosaic Datasets perform much faster than raster catalogs, and you have additional benefits such as on-the-fly processing. Also, when adding a mosaic dataset to an ArcMap session, it is added to the bottom of the table of contents.
... View more
09-10-2013
04:28 AM
|
0
|
0
|
1064
|
|
POST
|
Hi Leroy, Start an edit session and digitize a polygon around the area you would like removed. After the new polygon is created and is selected click the Editor dropdown > Clip. Keep the defaults on the Clip dialog and click OK: [ATTACH=CONFIG]27311[/ATTACH] Then delete the polygon you created and the area underneath should be removed.
... View more
09-10-2013
04:17 AM
|
0
|
0
|
5391
|
|
POST
|
Yes, that is correct. The MIN value will be the first value in the list, i.e. list[0].
... View more
09-09-2013
06:33 AM
|
0
|
0
|
1476
|
|
POST
|
Hi Ferial, You could accomplish this using a dictionary: dict = {}
for v in centerDisplacement.values:
dict[v.nodeLabel] = v.data[0]
#sort dictionary
list = sorted(dict, key=dict.get)
max = list[-1]
print 'Max displacement = ', dict[max]
print 'For the Node label = ', max
... View more
09-09-2013
03:50 AM
|
0
|
0
|
1476
|
|
POST
|
Can you post a code example of one of your python add-ins?
... View more
09-05-2013
03:58 AM
|
0
|
0
|
760
|
|
POST
|
Hi Pramod, When you start your services, an SDE connection will be made for each number of minimum instances you have set for that service. For example, if the minimum is set to 2, 2 SDE connections will be made. More instances are created when simultaneous requests are made to the same service, and the amount of requests exceeds the available instances. For example, if 3 requests were made to the same service, and only 2 instances were available, another instance will be created. If there a no instances available, i.e. the max number of instances has been reached, the client will have to wait until an instance is returned to the pool before their request is returned. What is the minimum number of instances set to for each of your 18 services? If no other users are connecting through any other clients, i.e. ArcMap/ArcCatalog, and you start your 18 services that each have a minimum number of instances set to 2, you should have 36 SDE connections. Also, when all the users are disconnected from the SDE geodatabase, and all services are stopped, query the sde.sde_process_information table. Check to make sure there are no orphaned connections listed here.
... View more
09-04-2013
04:57 AM
|
0
|
0
|
1831
|
|
POST
|
Hi Peter, Take a look at the following KB article on how the state tree changes: http://support.esri.com/en/knowledgebase/techarticles/detail/32352
... View more
09-04-2013
02:39 AM
|
0
|
0
|
782
|
|
POST
|
James, Here is tech article that discusses selecting multiple values: http://support.esri.com/en/knowledgebase/techarticles/detail/32024 Try the below. It should work whether you select one line or multiple lines: mxd = arcpy.mapping.MapDocument("CURRENT")
for lyr in arcpy.mapping.ListLayers(mxd):
dsc = arcpy.Describe(lyr)
sel_set = dsc.fidSet
if dsc.shapeType == "Polyline":
if len(sel_set) > 1:
sel_set = sel_set.replace(";", ",")
arcLengthList = []
shapeLengthList = []
rows = arcpy.SearchCursor(lyr, "OBJECTID IN (" + sel_set + ")")
for row in rows:
arcLengthList.append(row.ARCLENGTH)
shapeLengthList.append(row.shape.length)
i = 0
while i < len(arcLengthList):
if len(arcLengthList) > 1:
print arcLengthList
else:
print shapeLengthList
i += 1
else:
rows = arcpy.SearchCursor(lyr, "OBJECTID = " + sel_set)
for row in rows:
arcLength = row.ARCLENGTH
shapeLength = row.shape.length
if len(arcLength) > 1:
print arcLength
else:
print shapeLength
del row, rows
... View more
08-30-2013
12:04 PM
|
0
|
0
|
1635
|
|
POST
|
Hi Patrick, The tile size only affects rasters that are stored in TIFFs, file geodatabases, or an SDE geodatabase. See the following link: http://resources.arcgis.com/en/help/main/10.2/index.html#//001w00000021000000 As for the pyramids not being built, I found the following bug, NIM070791: The geoprocessing tool, Copy Raster, builds pyramids even if the build pyramids check box in the 'Environment Variable' is unchecked. This happens only when the output is a file raster (TIFF) and when setting any of the parameters like 'Ignore background value', 'colormapToRGB' or 'convert 1 bit data to 8 bit data.' This appears to occur for JP2 as well as TIFF files. When not specifying the 'Colormap to RGB' option, the OVR file is not created.
... View more
08-30-2013
09:15 AM
|
1
|
0
|
2563
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a month ago | |
| 4 | 05-07-2020 05:14 PM | |
| 1 | 03-25-2026 04:16 AM | |
| 1 | 03-16-2026 01:00 PM | |
| 1 | 12-22-2025 10:39 AM |
| Online Status |
Online
|
| Date Last Visited |
5 hours ago
|