|
POST
|
Are you selecting on a layer in your mxd or a different layer? I would recommend not doing this kind of processing on mxd layers as the map will want to catch up with the drawing while it processes in some cases.
... View more
06-24-2013
01:07 PM
|
0
|
0
|
1223
|
|
POST
|
It seems you have to have your IDE closed so ArcGIS can open it in debug mode. You then need to click on debug in the IDE.
... View more
06-20-2013
01:07 PM
|
0
|
0
|
528
|
|
POST
|
Katharina, Try reading through this link. The short version is you should connect to it first using pyodbc or some other method before you access it. http://support.esri.com/fr/knowledgebase/techarticles/detail/32976
... View more
06-20-2013
09:56 AM
|
0
|
0
|
1350
|
|
POST
|
Michael, I'd imagine it would be when they switch desktop to 64-bit native, since as far as I know .mdb files cannot be accessed by 64-bit applications. Server already has dropped support for personal geodatabases because of this. The earliest I'd imagine this would happen would be the version after 10.2. Of course they may simply switch personal geodatabases to .accdb and retain support. It's anyones guess at this point though, I haven't heard anything official either way.
... View more
06-19-2013
01:15 PM
|
0
|
0
|
1208
|
|
POST
|
First I would try to avoid personal geodatabases as support for them is waning. Second you can use a cursor with a where clause and do it all in 4 lines. cursor = arcpy.da.UpdateCursor(FPlan, ["PF"], '''"P" >= 30 AND (("PF" is null ) AND ("MC" = 300 ))''')
for row in cursor:
row[0] = 'Char'
row.updateRow(row)
... View more
06-19-2013
12:15 PM
|
0
|
0
|
1208
|
|
POST
|
... Round(NumberField / 2, 0) = NumberField / 2 Round(NumberField / 2, 0) <> NumberField / 2 ... Appending ObjectIDs into an SQL list is not a good approach if your database is very large (100K+ records), because the list will become huge and will take a long time to process (assuming it does not just fail). Plus by reading the database with a cursor you are effectively doubling the database read time, since the SelectLayerByAttribute tool will have to read the entire database again to select everything, making that approach very inefficient. For OID filtering this is the best answer here.
... View more
06-19-2013
06:54 AM
|
0
|
0
|
3020
|
|
POST
|
Some virus scanners can interfere when files are changed in scripts like from python. They can be locked in an attempt to determine if the action is malicious or not and prevent further processing. ArcGIS has an indexing service to calalog all GIS associated files in a given folder/database. You can check if it is on under Search Options in Catalog. This can also interfere with file changes if they are set to update too often.
... View more
06-18-2013
01:16 PM
|
0
|
0
|
2009
|
|
POST
|
That seems like very odd behaviour if you are getting a socket closed error on local files. Are you using SP1? Do you have ArcGIS indexing on? Have an anti-virus program? I'd recommend contacting Esri support, the only bug I found for Tabluate Area was NIM002809 with this solution The user's feature zone data had a range of 127707. Making a subscene of the data where the range was reduced below 100,000 (99,340 actually), the operation could complete.
... View more
06-18-2013
12:29 PM
|
0
|
0
|
2009
|
|
POST
|
Are these files located on a network drive or server? That error seems to indicate you lost connection to that location temporarily. Try copying your data to a local drive to see if you get the same errors.
... View more
06-18-2013
11:54 AM
|
0
|
0
|
2009
|
|
POST
|
To your original question, the tool 'should' preserve field order. With the caveat the system fields usually rearrange themselves. Eg OID, Shape, Your_Fields, Shape_Length/Area Also here are some of the quick trials I ran to show the difference between straight index referencing and dict field name referencing and the code used to generate them below. Was going through ~900k rows in a table. index time: 19.5900778076 index time: 19.2306036588 index time: 19.4666773613 index time: 19.395765612 index time: 19.5033476872 index time: 19.3282738665 index time: 19.2130868052 index time: 19.0405310563 index time: 19.115207967 index time: 19.1235100947 dict time: 20.4310177626 dict time: 20.4020019139 dict time: 20.3490997958 dict time: 20.4130341569 dict time: 20.2006479064 dict time: 20.3282768531 dict time: 20.168064434 dict time: 20.0710841148 dict time: 20.1822551461 dict time: 20.4257584827 def main_index():
curs = arcpy.da.SearchCursor(table, '*')
t0 = _timer()
for row in curs:
val1 = row[6]
val2 = row[7]
t1 = _timer() - t0
index_times.append(t1)
print('index time: {0}'.format(t1))
def main_dict():
curs = arcpy.da.SearchCursor(table, '*')
t0 = _timer()
d = {}
for index, field in enumerate(curs.fields):
d[field] = index
for row in curs:
val1 = row[d['POLY_NUM']]
val2 = row[d['TYPE']]
t1 = _timer() - t0
dict_times.append(t1)
print('dict time: {0}'.format(t1))
... View more
06-18-2013
08:04 AM
|
0
|
0
|
1408
|
|
POST
|
Your cursor has a field property that you can query to get a tuple of field names in the index order they are in. Eg templateRows.fields Edit: To bridge the gap that remains you can just make a dictionary of index/field name values to reference the name instead of the index. for index, field in enumerate(templateRows.fields): d[field] = index So you can do something like this. for row in templateRows: val = row[d["field_name"]] Dictionaries are pretty efficient so I don't imagine this would be a big hit on performance, thought I haven't done any benchmarks on it.
... View more
06-18-2013
06:48 AM
|
0
|
0
|
1408
|
|
POST
|
You'd just need to use string substitution. Something like this. exp = '"SystemOwner" = \'{0}\''.format(variable)
... View more
06-17-2013
02:47 PM
|
0
|
0
|
942
|
|
POST
|
Make Feature Layer and most other GP tools honour selections. If you are running in the background that may cause issues. Edit: Also, are you sure you are passing in the layer with the selection as the parameter and not the feature class the selection is based off of? Try posting your complete tool.
... View more
06-17-2013
07:37 AM
|
0
|
0
|
719
|
|
POST
|
Why not just create a table view? Edit: Even with this method you should remove the shape field explicitly. You can remove by geometry type field instead of name if that is easier for you.
... View more
06-17-2013
07:23 AM
|
0
|
0
|
3252
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-17-2011 10:36 AM | |
| 1 | 08-16-2012 10:48 AM | |
| 1 | 10-31-2012 08:39 AM | |
| 1 | 07-16-2012 01:52 PM | |
| 1 | 03-15-2012 10:57 AM |
| Online Status |
Offline
|
| Date Last Visited |
08-22-2024
11:12 PM
|