POST
|
So I developed a script that traverses through a root directory, and any subdirectories and catalogs layers files. Then exports these layer files' FGDC metadata and outputs them to a folder. The code at this point is hit/miss sometimes completes and sometimes processes "most" of the input and errors out close to being done. Can anyone point out what's going on here? Error code is File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\conversion.py", line 624, in ExportMetadata raise e ExecuteError: ERROR 000582: Error occurred during execution. import arcpy,os
arcpy.env.overwriteOutput=True
metadataout=r'C:\tmp\out'
for dirpath,dirnames,filenames in arcpy.da.Walk(r'C:\folder\files',datatype="Layer"):
for filename in filenames:
print filename
translator = r'C:\Program Files (x86)\ArcGIS\Desktop10.2\Metadata\Translator\ARCGIS2FGDC.xml'
arcpy.ExportMetadata_conversion(os.path.join(dirpath,filename),translator,os.path.join(metadataout,str(filename).split(".")[0]+'.xml'))
... View more
03-11-2015
12:05 PM
|
0
|
1
|
3708
|
POST
|
Hi everyone, I am looking to return the subtype domains associated with a subtype field. I was able to explore arcpy.da.ListSubtypes however this function seems to return a dictionary and I seem to be getting lost thereafter. Is there a quick way to isolate only the subtype domains from the dictionary? Thanks!
... View more
01-21-2015
06:39 PM
|
1
|
4
|
7024
|
POST
|
I am attempting to read an attribute field's default value and write it to a csv. I was able to write all the properties except for the default value. I am referencing this online resouce: http://resources.arcgis.com/en/help/main/10.1/index.html#//018z0000004n000000 If there is something that I am missing or if anyone knows of an alternate solution to help accomplish then I would really appreciate it if you could share it with the community.
... View more
08-07-2014
02:51 PM
|
0
|
3
|
1260
|
POST
|
Thank you eibenm, In fact, I am not intend to do after the attribute table is opened. As user's request, I create a new arctoolbox with several script tools using python. After entering the searching criteria, a table with the selected features data need to displayed on the map in a table format. I am not sure whether I should try to open the attribute table or I should create a table on this. Any body have experience on this? thanks Sounds like what you are after is the TableView class in mapping module http://resources.arcgis.com/en/help/main/10.2/index.html#/TableView/00s300000017000000/ example import arcpy mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd") df = arcpy.mapping.ListDataFrames(mxd, "Transportation")[0] accidentsTable = arcpy.mapping.TableView(r"C:\Project\Data\Transportation.gdb\Accidents") arcpy.mapping.AddTableView(df, accidentsTable) mxd.saveACopy(r"C:\Project\Project2.mxd") del mxd, accidentsTable
... View more
05-08-2014
05:56 AM
|
0
|
0
|
627
|
POST
|
I have a csv that looks like this: A,B,C,D (Newline) 2,3,4,feature_1 1,2,4,feature_1 #Average line "","",4 (Newline) 3,6,7,feature_2 1,2,6,feature_2 #Average line "","",""6.5 I want to be able to take the rows for each "feature" and write another line that takes the average of the values in column "C". I have inserted comments for your convenience.
... View more
04-30-2014
08:57 AM
|
0
|
2
|
533
|
POST
|
you can create a sorted list of unique PLSS values lst=sorted(set([row.getValue("attr field") for row in arcpy.SearchCursor(feature_class_name)]))
... View more
04-29-2014
05:49 AM
|
0
|
0
|
197
|
POST
|
Is there a particular reason that you are using the python toolbox vs. using the esri template interface?
... View more
04-25-2014
08:04 AM
|
0
|
0
|
1453
|
POST
|
The arcpy.Delete_management("temp_layer") should be outside of the for loop, yet on the same indentation. You want the temp layer to be deleted after you have processed the items in the list.
... View more
04-15-2014
05:13 AM
|
0
|
0
|
1094
|
POST
|
The correct syntax for in_memory is "in_memory\\file". When you want to clear in memory you should simply do arcpy.Delete_management("in_memory")
... View more
04-15-2014
05:01 AM
|
0
|
0
|
456
|
POST
|
Dear FLBB It gives me Following Error Traceback (most recent call last): File "J:\Gampaha\Scripts\Script1.py", line 109, in <module> if row.isNULL("CNT_PT_ID")==True: File "c:\program files\arcgis\desktop10.1\arcpy\arcpy\arcobjects\_base.py", line 28, in __getattr__ raise AttributeError("%s" % attr) AttributeError: isNULL Failed to execute (LISTool1.0). Thanks You typed "isNULL". You need to be typing "isNull". Case sensitivity very important in python.
... View more
04-09-2014
01:10 AM
|
0
|
0
|
473
|
POST
|
It should look something like this: cur = arcpy.UpdateCursor("CNT_Anno")
for row in cur:
val1 = row.getValue("Some attribute field")
if val1.isdigit():
if int(val1) >= 9000:
row.setValue("CNT_PT_ID", int(val1))
cur.updateRow(row)
if row.isNull("CNT_PT_ID")==True:
cur.deleteRow(row)
del cur
del row you may also be able to get away with deleting the isdigit() line.
... View more
04-08-2014
03:17 AM
|
0
|
0
|
473
|
POST
|
I'm having a similar problem, but I cannot see what I am doing wrong. import arcpy
from arcpy import env
env.workspace = r"F:Replicated Data\Auto_Extract_Connection.sde"
datasetList = arcpy.ListDatasets()
print datasetList
env.workspace = r"F:\Replicated Data\Gatekeeper_Extract.gdb"
datasetList = arcpy.ListDatasets()
print datasetList This returns [] [u'ElectricDataset', u'CPUDataset', u'TransmissionDataset'] It's clearly connecting to the file GDB but won't connect to the SDE one. I know the connection file is working, I can connect with it through Catalog. try this: arcpy.env.workspace = r'F:Replicated Data\Auto_Extract_Connection.sde' ... for ds in arcpy.ListDatasets(): ... print ds
... View more
04-04-2014
05:25 PM
|
0
|
0
|
3839
|
POST
|
Now the problem in that script is that I want to write the data extracted from the 2nd table in the 1st table (instead of just "printing" it"). I know I have to use an UpdateCursor but in don't understand how to use it properly when dealing with two tables instead of just one. Exemples I have seen are for taking a data in a field and writing something in another field inside the same table. So instead of printing data_to_write, I want to write it in the table of in_feature in the field "ph" Confused... If I am understanding correctly, you to do a searchcursor using in feature indexing it to field "ph" then you need to loop each row in the field... something like with open('path to text file.txt','w') as f: lst= [row.getvalue(field) for row in arcpy.searchcursor(in_feature, field)] for item in lst: f.write(item)
... View more
03-31-2014
06:30 AM
|
0
|
0
|
364
|
Title | Kudos | Posted |
---|---|---|
1 | 01-21-2015 06:39 PM | |
1 | 04-24-2015 02:49 PM | |
1 | 04-26-2015 11:13 PM | |
1 | 05-21-2015 12:41 PM | |
1 | 05-21-2015 03:37 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|