|
POST
|
So your problem is nothing is ever removed from your selected features? Can you post your data you are running this on? Or at least the printout of the results from one of the runs? I'd also try using meters instead of kilometers. Overall this seems like a very convoluted work flow, but I don't understand enough of your problem to comment on a way to improve it.
... View more
10-11-2012
12:33 PM
|
0
|
0
|
1722
|
|
POST
|
Something like this should work. import arcpy
import os
# Set Workspace
env.workspace = r"Database Connections\GENERAL_DATA - PROD.sde"
# List Feature Classes
fcList = arcpy.ListFeatureClasses("MGISP.GISONEAST*")
# Loop through each feature class
for fc in fcList:
# move features from sde to gis01
arcpy.FeatureClassToFeatureClass_conversion(fc, os.path.join(output_folder, my_dir, my_gdb), fc[16:], "") You could also do something like this, depending on your situation. fc.lstrip("MGISP.GISONEAST")
... View more
10-11-2012
10:34 AM
|
0
|
0
|
843
|
|
POST
|
You'll need to have access to the directory on the remote computer. If you can't navigate to it in windows explorer you probably won't have access.
... View more
10-11-2012
08:51 AM
|
0
|
0
|
817
|
|
POST
|
Please read this thread. http://forums.arcgis.com/threads/48475-Please-read-How-to-post-Python-code Python uses elif. Also, here is a better way of seeing if nothing is selected. dsc = arcpy.Describe("LayerName")
selection_set = dsc.FIDSet
if len(selection_set) == 0:
... View more
10-11-2012
07:20 AM
|
1
|
0
|
8766
|
|
POST
|
I believe I found a reason to keep Python. Could someone confirm for me if the "Feature Class to Shapefile" tool in the toolbox under Conversion tools is a Python script? The icon for this tool seems to resemble a script as opposed to the normal hammer icon. [ATTACH=CONFIG]18361[/ATTACH] Yes it is.
... View more
10-11-2012
05:23 AM
|
0
|
0
|
1792
|
|
POST
|
is python 2.6.5 compatiable with ArcGis 9.3.1? I do not believe so. You will need Python 2.5.x
... View more
10-10-2012
10:14 AM
|
0
|
0
|
1550
|
|
POST
|
Not sure if this is what you are looking for. I use DB managed groups instead of AD users, so you will need to find a way to tap into AD to get your list of users to grant the privileges to and loop through them. The win32api or active_directory modules should be able to get what you want. http://timgolden.me.uk/python/active_directory.html http://www.python.org/getit/windows/ import arcpy
sde = r"sde_instance_path.sde"
arcpy.env.workspace = sde
fc_List = arcpy.ListFeatureClasses("some_filter")
fc_List.sort()
for fc in fc_List:
try:
print "Granting privileges to " + fc
arcpy.ChangePrivileges_management(fc, "# group/user to grant priv", "GRANT")
except:
print "Passing " + fc
pass
... View more
10-02-2012
10:16 AM
|
0
|
0
|
616
|
|
POST
|
Here is a library for Python: http://pypi.python.org/pypi/mgrs#downloads Well there you go. Python really can do anything. Just remember to get the right version for your python install. (2.5 for ArcGIS 9.3)
... View more
10-02-2012
09:40 AM
|
0
|
0
|
5295
|
|
POST
|
I'm sure it is possible, just not sure how feasible. You could try starting here to get ideas. Java and Python have a strong enough relationship that it should be fairly easy to cross over. http://www.ibm.com/developerworks/java/library/j-coordconvert/
... View more
10-02-2012
09:10 AM
|
0
|
0
|
5295
|
|
POST
|
It's a way to replace almost anything you would regularly do manually with an automated script or tool. Geoprocessing, data management, logging, export PDF maps etc are all useful way to leverage python in a GIS environment. This thread has some good resources on learning python. http://forums.arcgis.com/threads/67761-Python-Textbook
... View more
10-01-2012
11:00 AM
|
0
|
0
|
682
|
|
POST
|
Sorry about that....Yes it is the outShp variable that the script doesn't recognize I would imagine you are looking for an actual shapefile (.shp) to create the feature layer from? Or did you create a feature class in a geodatabase? I'd try something like this, probably not really needed depending on your needs, but you should be able to adapt to your purposes if the output type/extension is the issue you are indeed having. import arcpy
outWorkspace = arcpy.GetParameterAsText(0)
arcpy.env.workspace = outWorkspace
arcpy.CheckOutExtension("3D")
try:
fcs = arcpy.ListRasters()
for fc in fcs:
outRaster = "reclass_" + fc
#Reclassify's raster cells
arcpy.Slice_3d(fc, outRaster, 2, "EQUAL_INTERVAL")
outShp = fc.strip(".tif")
if outWorkspace.endswith(".gdb"):
output_type = "FGDB"
output = os.path.join(outWorkspace, "%s" % outShp)
elif outWorkspace.endswith(".mdb"):
output_type = "PGDB"
output = os.path.join(outWorkspace, "%s" % outShp)
else:
output_type = "SHP"
output = os.path.join(outWorkspace, "%s.shp" % outShp)
#converts raster to polygon shapefile
arcpy.RasterToPolygon_conversion(outRaster, output, "SIMPLIFY", "VALUE" )
outLyr = outShp + "_lyr"
#make layer from shapefile so I can select by attribute
arcpy.MakeFeatureLayer_management(outShp, outLyr)
arcpy.SelectLayerByAttribute_management(outLyr, "NEW_SELECTION", ' "GRIDCODE" = 1 ')
... View more
10-01-2012
05:11 AM
|
0
|
0
|
1265
|
|
POST
|
Please read. http://forums.arcgis.com/threads/48475-Please-read-How-to-post-Python-code Is it your "outShp" variable it is saying does not exist?
... View more
09-27-2012
01:51 PM
|
0
|
0
|
1265
|
|
POST
|
I think you need to start at square one here. There is no reason to use a search cursor and an update cursor at the same time on the same feature class. This should be all you need in your try statement. try: # Create Update Cursor urows = arcpy.UpdateCursor(featureclass) # Cycle through the rows # to actually update the row in the cursor # with the values obtained from the search cursor for urow in urows: contour = urow.CONTOUR if int(float(contour) / 10) == (float(contour) / 10): urow.INDEX_VALU = "10 Foot Index" urows.updateRow(urow) print 'DONE' del urow, urows
... View more
09-27-2012
01:25 PM
|
0
|
0
|
853
|
|
POST
|
Works fine for me. Not sure why you need the semicolon at the end of your lines. This isn't Java. What version of Python and win32 are you using? Also, you do this from win32con import MB_OK, MB_YESNO But call it like this anyways? win32con.MB_YESNO Wait, are you trying to execute this as a script tool through ArcMap? I don't think that will work. Why not just have a checkbox in the tool window asking if it is downloaded? Or better yet, ask them to navigate to it using a file dialogue, or search for it in the script itself.
... View more
09-27-2012
09:02 AM
|
0
|
0
|
3638
|
|
POST
|
Those don't look like proper unicode quotation marks. `1` should be '1' etc Not sure how that issue would just appear over night though. Or why they are there in the first place. May just be a hold over from the older version of python. I don't get a syntax error with it but it just doesn't look right with those characters.
... View more
09-26-2012
01:41 PM
|
0
|
0
|
1684
|
| 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
|