|
POST
|
Is your database doing something at that time? Backup, compacting etc? Other server/network things going on? Have you tried scheduling it for a different time? Have you tried scheduling your other scripts that do run to run at 2am to see if they fail then?
... View more
08-18-2011
01:32 PM
|
0
|
0
|
1341
|
|
POST
|
Can you use feature class to feature class without exporting to SDE? Are you sure all your feature class names are legal? "GEOMETRY" is the database keyword you are using? 9s errors are a pain to track down.
... View more
08-18-2011
01:27 PM
|
0
|
0
|
10508
|
|
POST
|
I don't see anything in the documentation that indicates you cannot send the results of a arcpy.Project_management operation to an in-memory feature class. Just specify your output as "in_memory\\reprojected" or something similar. When you're done with it, if you want to manually clear it out of memory, just use the arcpy.Delete_management tool, specifying it exactly as in the project tool. Of course, just because the documentation doesn't say anything about requiring a physical storage output doesn't mean it isn't true. You're just gonna have to try it! http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000007m000000.htm Point #4 under Usage
... View more
08-15-2011
05:18 AM
|
0
|
0
|
272
|
|
POST
|
Is there some kind of processing you need to do that requires you to loop through a list? You can simply create a list of shapefiles and bulk load them as you have done. You could try just making it a list to be more readable shape_list = ["K:\\SUURGO_Data\\IA\\soil_ia001\\soil_ia001\\spatial\\soilmu_a_ia001.shp",
"K:\\SUURGO_Data\\IA\\soil_ia003\\soil_ia003\\spatial\\soilmu_a_ia003.shp",
"K:\\SUURGO_Data\\IA\\soil_ia005\\soil_ia005\\spatial\\soilmu_a_ia005.shp",
"K:\\SUURGO_Data\\IA\\soil_ia197\\soil_ia197\\spatial\\soilmu_a_ia197.shp",
"K:\\SUURGO_Data\\IA\\soil_ia053\\soil_ia053\\spatial\\soilmu_a_ia053.shp"]
arcpy.FeatureClassToGeodatabase_conversion(shape_list, IA_gdb__2_)
... View more
08-11-2011
02:58 PM
|
0
|
0
|
1292
|
|
POST
|
My understanding is that you can use an in_memory feature layer as an input to a project tool, but not an output.
... View more
08-10-2011
08:24 AM
|
0
|
0
|
1743
|
|
POST
|
Wrapping your code in [ CODE][/CODE ] tags lets you preserve your formatting. As to the question, do both Rasters have unique names? Same coordinate systems? When you list the rasters do both come up? The syntax for limiting the list by .tif images is "TIFF" I believe.
... View more
08-10-2011
08:16 AM
|
0
|
0
|
1358
|
|
POST
|
Yes that is just simple string manipulation, since raster = "originalfilename.tif" when you do outraster = raster+"_olp.tif" you get the logical originalfilename.tif_olp.tif There are a couple ways to solve that issue. raster = raster.rpartition(".")[0]
... View more
08-09-2011
08:10 AM
|
0
|
0
|
1358
|
|
POST
|
"raster" and "outraster" are variables not string names, so remove the quotes and try that.
... View more
08-09-2011
07:32 AM
|
0
|
0
|
1358
|
|
POST
|
Thank you. "The teacher is no longer merely the-one-who-teaches, but one who is himself taught in dialogue with the students, who in turn while being taught also teach. They become jointly responsible for a process in which all grow." -Paulo Freire
... View more
06-22-2011
02:43 PM
|
2
|
0
|
2096
|
|
POST
|
Append should work... I've never tried it within a script while editing, but it does work on versioned data that is being edited.
... View more
06-22-2011
12:05 PM
|
0
|
0
|
497
|
|
POST
|
Ok, you will want to make a list of both datasets first, from your input workspaces. import arcpy
MasterDataset = arcpy.GetParameterAsText (0)
fcs = arcpy.GetParameterAsText (1)
arcpy.env.workspace = MasterDataset
fclist = arcpy.ListFeatureClasses()
arcpy.env.workspace = fcs
fcslist = arcpy.ListFeatureClasses()
for fc in fcslist:
if fc in fclist:
arcpy.Delete_management(fc)
... View more
06-22-2011
10:17 AM
|
0
|
0
|
2096
|
|
POST
|
What exactly is MasterDataset, and what is fcs? Also, why do you limit your deletes to Feature Class only? Are there tables etc with similar names you want to keep? Feature Class should also be two words iirc.
... View more
06-22-2011
09:13 AM
|
0
|
0
|
2096
|
|
POST
|
I did something similar, looks like this. Counting features in a feature class and making sure they have the same number of features as another feature class. You could just modify it so it just tests whether it is there is or isn't a feature class of that name. Would be a simple like like if fc2 not in fcList: print fc2+" not found" import arcpy
sde1 = r"D:\sde_transit\sde1.gdb"
output = r"C:\Users\coylema\AppData\Roaming\ESRI\Desktop10.0\ArcCatalog\Connection to winms-wooddb.sde"
#output = r"D:\sde_transit\sdeCSRS.gdb"
arcpy.env.workspace = r"D:\sde_transit\sde1.gdb"
sdeList = arcpy.ListFeatureClasses()
for fc in sdeList:
result = arcpy.GetCount_management(fc)
count1 = result.getOutput(0)
fc2 = output+"\\TFM_BKG."+fc
if arcpy.Exists(fc2):
result = arcpy.GetCount_management(fc2)
count2 = result.getOutput(0)
if count1 == count2:
print fc+" OK"
else:
print "Problem with "+fc
print count1
print count2
else:
print fc2+" not found"
pass
# Clean up
sdeList = None
del arcpy.env.workspace
del arcpy
... View more
06-22-2011
05:58 AM
|
0
|
0
|
2096
|
|
POST
|
Here's a sample of using field mapping. Not as hard as it looks once you get some practice. block_out = str(sel)+"_blocks"
field_mappings = arcpy.FieldMappings()
field_mappings.addTable(block_lyr)
fldmap_OBJID = arcpy.FieldMap()
fldmap_BLOCKSTAGE = arcpy.FieldMap()
fldmap_AREAGIS = arcpy.FieldMap()
fldmap_OPTYPE = arcpy.FieldMap()
fldmap_BLOCKTYPE = arcpy.FieldMap()
fldmap_HARVSEASON = arcpy.FieldMap()
fldmap_ROADPERCNT = arcpy.FieldMap()
#fldmap_SOURCEID = arcpy.FieldMap(8,"","Join")
fldmap_OBJID.addInputField(block_lyr, "OBJECTID")
fld_OBJID = fldmap_OBJID.outputField
fld_OBJID.name = "O_OID"
fldmap_OBJID.outputField = fld_OBJID
field_mappings.addFieldMap(fldmap_OBJID)
fldmap_BLOCKSTAGE.addInputField(block_lyr, "BLOCKSTAGE")
fld_BLOCKSTAGE = fldmap_BLOCKSTAGE.outputField
fld_BLOCKSTAGE.name = "BLOCKSTAGE"
fldmap_BLOCKSTAGE.outputField = fld_BLOCKSTAGE
field_mappings.addFieldMap(fldmap_BLOCKSTAGE)
fldmap_AREAGIS.addInputField(block_lyr, "AREAGIS")
fld_AREAGIS = fldmap_AREAGIS.outputField
fld_AREAGIS.name = "AREAGIS"
fldmap_AREAGIS.outputField = fld_AREAGIS
field_mappings.addFieldMap(fldmap_AREAGIS)
fldmap_OPTYPE.addInputField(block_lyr, "OPERATIONSTYPE")
fld_OPTYPE = fldmap_OPTYPE.outputField
fld_OPTYPE.name = "OPTYPE"
fldmap_OPTYPE.outputField = fld_OPTYPE
field_mappings.addFieldMap(fldmap_OPTYPE)
fldmap_BLOCKTYPE.addInputField(block_lyr, "BLOCKTYPE")
fld_BLOCKTYPE = fldmap_BLOCKTYPE.outputField
fld_BLOCKTYPE.name = "BLOCKTYPE"
fldmap_BLOCKTYPE.outputField = fld_BLOCKTYPE
field_mappings.addFieldMap(fldmap_BLOCKTYPE)
fldmap_HARVSEASON.addInputField(block_lyr, "HARVESTSEASON")
fld_HARVSEASON = fldmap_HARVSEASON.outputField
fld_HARVSEASON.name = "HARVSEASON"
fldmap_HARVSEASON.outputField = fld_HARVSEASON
field_mappings.addFieldMap(fldmap_HARVSEASON)
fldmap_ROADPERCNT.addInputField(block_lyr, "ROADPERCENTAGE")
fld_ROADPERCNT = fldmap_ROADPERCNT.outputField
fld_ROADPERCNT.name = "ROADPERCNT"
fldmap_ROADPERCNT.outputField = fld_ROADPERCNT
field_mappings.addFieldMap(fldmap_ROADPERCNT)
for selection in blocklist:
if blockPrev <> selection and not arcpy.Exists(block_out+".shp"):
block_query = ("\""+str(block_id)+"\" = \'"+str(selection)+"\' AND (BLOCKSTAGE = 'APPR')")
arcpy.FeatureClassToFeatureClass_conversion(block_lyr, exportdir, block_out, block_query, field_mappings) Or here is the alternative dropFields = list()
fieldList = arcpy.ListFields(block_out+".shp")
keep_list = ["O_OID","SOURCEID","BLOCKTYPE","ROADPERCNT","BLOCKSTAGE","AREAGIS","OPERATIONS","HARVSEASON","OBJECTID","PLANNEDVOL","OID","Geometry"]
for f in fieldList:
#print f.name
if f.name not in keep_list and f.type not in keep_list:
dropFields.append(f.name)
#print dropFields
arcpy.DeleteField_management(block_out+".shp", dropFields)
... View more
06-21-2011
01:45 PM
|
0
|
0
|
3805
|
|
POST
|
I wrote a script that replicated some of that "lost" functionality with .mxts, I found it surprisingly easy to write/modify text based on what you want. I run it as a stand alone script to export PDFs that dynamically set the author/date/title as well as data populated by the selected area filled into predefined text elements. I am working on creating a Tkinter GUI for it now to make it a little more user friendly, but this entire process could easily be loaded into a script tool in arc. The reason I didn't go that direction is that I find the overhead of having to open Arc, find and open an .mxd, zoom to where you want to go, then run a tool to fill in the text elements you want, too much when all you want to do is print or export a PDF of a map you've already set up.
... View more
06-16-2011
05:47 AM
|
0
|
0
|
1153
|
| 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
|