|
POST
|
I can't seem to find any reference to this in help or forums, but it seems a da cursor cannot apply a where clause to a layer with a where clause already applied. Does anyone know if this is this working as intended behaviour or a bug? Here is some test code where this occurred. import arcpy data = r'D:\GIS\DataBase\misc.gdb\CLI_N' lyr = 'temp' arcpy.MakeFeatureLayer_management(data, lyr, 'OBJECTID < 100') print(arcpy.GetCount_management(lyr)) count = 0 cursor = arcpy.da.SearchCursor(lyr, 'OBJECTID', 'OBJECTID < 10') for _ in cursor: count += 1 print(count) This code returned >>> 99 99
... View more
07-16-2013
09:24 AM
|
0
|
7
|
1664
|
|
POST
|
Are you trying to extract one particular row from your data? Or are you trying to start at an arbitrary row and continue from that?
... View more
07-16-2013
07:43 AM
|
0
|
0
|
1853
|
|
POST
|
Would this work? expression3 = '"{field1}" = \'{add}\' AND "{field2}" LIKE \'%{street}%\''.format(field1=field1, add=add, field2=field2, street=street)
... View more
07-16-2013
07:41 AM
|
0
|
0
|
7265
|
|
POST
|
Is 'attribute' the name of your field? You should include more of your code to see what you are trying to accomplish.
... View more
07-16-2013
07:12 AM
|
0
|
0
|
1853
|
|
POST
|
I'm not sure I follow what you are trying to do. Something like this? "{0} LIKE '%{1}'".format(field, value_suffix)
... View more
07-16-2013
07:03 AM
|
0
|
0
|
7265
|
|
POST
|
Are you trying to use a da cursor? sorted(arcpy.da.SearchCursor(table, 'atribute'))
... View more
07-16-2013
06:57 AM
|
0
|
0
|
1853
|
|
POST
|
If you do this test you'll find you are not getting a list but a string. type(pageNameList) Probably something like this "\"DSA107\";\"DSA108\"" You'll need to convert the string to a list, this may work for you. pageNameList = pageNameList.split(';')
... View more
07-15-2013
07:36 AM
|
0
|
0
|
946
|
|
POST
|
I've been trying to use a definition query just like rbasaria, and have used the syntax that clm42 suggested, but keep running into trouble. For now, I just want to be able to query out various zones from a larger map, and then run further geoprocessing functions on them. import arcpy
from arcpy import env
import os
inzones = (.../RevisedGroundZones)
for lyr in inzones:
if lyr.name == "RevisedGroundZones":
lyr.definitionQuery = ' "Grounds_GSC_Zones" = \'2\'' When running it from the python window in ArcMap, I get an error message that says AttributeError: 'str' object has no attribute 'name' and when I run it as a script tool in ArcCatalog, I get an error saying that there is no definition Query function for 'lyr' Any help would be very appreciated, thanks! Can you post the rest of your code? How you create the mxd object etc. You need to make a layer object to get the name property from it if you are running this out of process.
... View more
07-15-2013
05:37 AM
|
0
|
0
|
5468
|
|
POST
|
Just use a dictionary with the domain value/description so you can reference one with the other.
... View more
07-02-2013
06:25 AM
|
0
|
0
|
1862
|
|
POST
|
I found what is the problem! Thanks for your help... It seems to have a problem when I triy to write the dbf table inside a gdb. I tested the script and when you write in the different location, everything works fine. If you try to write on a gdb - the same where the input feature class is - you get an error saying the table cannot be created...The probme is solved but I would like to know why this happens and of course I would like to write the table in the same gdb where the in put feature class is. Thanks for your help and....any ideas??? You cannot write a dbf to a gdb... you would have to create a gdb table.
... View more
07-02-2013
06:21 AM
|
0
|
0
|
1647
|
|
POST
|
It requires a numeric field. Edit: Nevermind, it seems the help is outdated. You can count non-numeric fields.
... View more
06-27-2013
11:19 AM
|
0
|
0
|
1647
|
|
POST
|
Thank you for the suggestion and helpful script. When I run this on a larger folder (100+) it crashes IDLE. But ran nicely on only 5 or so folders. Thoughts? This is very likely due to running out of memory during the process.
... View more
06-27-2013
09:55 AM
|
0
|
0
|
3904
|
|
POST
|
lyr_Bid = arcpy.mapping.ListLayers(mxd, "Tracts Receiving Bids")[0]
This layer is created in the model. I removed that line out of my script and it ran successfully. I suppose the issue is that the "Tracts Receiving Bids" layer isn't displayed until the whole model, script and all, runs completely. Is there a way to display that layer after it is created? This is how it works when running it within model builder. If you only need the layer for the model you can use the Make Feature Layer tool and reference it in memory. If you need to add it to the map you can then use the Add Layer function in the mapping module after processing.
... View more
06-27-2013
06:28 AM
|
0
|
0
|
1193
|
|
POST
|
If you are running it out of process you may have problems with the 'current' keyword for your mxd, but that should give you a different error. Are any of those layers created within the model you are running? Or do they all exist in the mxd prior to the model running?
... View more
06-27-2013
05:18 AM
|
0
|
0
|
1193
|
|
POST
|
I'd wager it was because one of those layers you are trying to reference do not exist in the mxd.
... View more
06-26-2013
01:46 PM
|
0
|
0
|
1193
|
| 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
|