|
POST
|
Hi Ryan, You will need to specify not to build pyramids in the 'Environments' of the Clip tool. To do this, click on the Environments at the bottom of the tool > Raster Storage > uncheck 'Build Pyramids'. Take a look at the following link: http://resources.arcgis.com/en/help/main/10.2/index.html#//001w0000001w000000
... View more
12-16-2013
09:36 AM
|
0
|
0
|
1991
|
|
POST
|
Hi Tony, I would recommend just running the Copy function on the entire File Geodatabase. This will ensure that you are backing up new feature classes, as well as updates that have been made to existing feature classes. When doing this for SQL Server, it would be best to create a database backup (.bak). This will backup any versions, archiving, views, etc that the database may have. Here is an example that uses the PYODBC module. # imports import pyodbc #define database db = "STATE" # define the backup paths server_backup_path = 'c:\\temp\\' # Connection object (notice that i dont include the database name) conn = pyodbc.connect('DRIVER={SQL Server};SERVER=<server name>;Trusted_Connection=yes', autocommit=True) def backup_db(conn_obj, db_name, server_backup_path): try: os.remove(client_backup_path + db_name + r'_sql.bak') except: pass cur = conn_obj.cursor() try: cur.execute('BACKUP DATABASE ? TO DISK=?', [db_name, server_backup_path + db_name + r'_sql.bak']) while cur.nextset(): pass cur.close() except: print 'cant backup: ' + db_name backup_db(conn, db, server_backup_path) # close the connection conn.close()
... View more
12-16-2013
09:18 AM
|
1
|
0
|
3688
|
|
POST
|
Yes, this worked for me. Add some print statements to your code so you can see where it is failing at. Ex: import arcpy
from arcpy import env
# Set environment settings
env.workspace = r"C:\Users\mbs7038\Documents\ArcGIS\matDEM"
try:
# Set the local variables
in_Table = "LatLonElev.txt"
x_coords = "Lon"
y_coords = "Lat"
z_coords = "Elev"
out_Layer = "ElevPts_layer"
saved_Layer = "ElevPts.lyr"
# Set the spatial reference
print "Set spatial reference"
spRef = arcpy.SpatialReference("WGS 1984")
# Make the XY event layer
print "Make XY event layer"
arcpy.MakeXYEventLayer_management(in_Table, x_coords, y_coords, out_Layer, spRef, z_coords)
# Save to a layer file
print "Saving layer file"
arcpy.SaveToLayerFile_management(out_Layer, saved_Layer)
#===============================================================================
# Copy features to shapefile
print "Copying features to shapefile"
arcpy.CopyFeatures_management(saved_Layer, "ElevPts.shp")
#===============================================================================
except:
print arcpy.GetMessages()
... View more
12-16-2013
02:16 AM
|
0
|
0
|
1035
|
|
POST
|
Yes, that is correct. http://resources.arcgis.com/en/help/main/10.2/index.html#//00170000000p000000
... View more
12-12-2013
09:22 AM
|
0
|
0
|
1480
|
|
POST
|
Hi Justin, Is the dataList used in a later part of your script? The ReconcileVersions tool does not use this list. It will use a list of versions that you have set to the variable 'verList'. If the dataList is not used in a later part of you script, you can comment it out and you should be able to reconcile all of your versions successfully.
... View more
12-12-2013
09:19 AM
|
0
|
0
|
3246
|
|
POST
|
Hi Bryce, In ArcMap, run the spatial join tool with all parameters set and then open your Results window (Geoprocessing menu > Results). Right-click on the completed tool > Copy as Python snippet. You can then paste this into your IDE and see the correct syntax.
... View more
12-12-2013
09:00 AM
|
0
|
0
|
1106
|
|
POST
|
I believe that is a typo within the help. If you look under 'Environments' on the help page, EXTENT is not listed.
... View more
12-12-2013
08:44 AM
|
0
|
0
|
1462
|
|
POST
|
The problem was with the coordinate system. Replace: spRef = r("GCS_WGS_1984") With: spRef = arcpy.SpatialReference("WGS 1984") Also, a good suggestion is to add print statements throughout the code to pinpoint where the code is failing.
... View more
12-12-2013
06:44 AM
|
0
|
0
|
4409
|
|
POST
|
One thing you could do is create a polygon from the data frame's extent, and then perform a Select Layer by Location to select all features that intersect the polygon. Ex: import arcpy from arcpy import env from arcpy import mapping mxd = mapping.MapDocument("CURRENT") df = mapping.ListDataFrames(mxd)[0] #create polygon from data frame extent XMAX = df.extent.XMax XMIN = df.extent.XMin YMAX = df.extent.YMax YMIN = df.extent.YMin pnt1 = arcpy.Point(XMIN, YMIN) pnt2 = arcpy.Point(XMIN, YMAX) pnt3 = arcpy.Point(XMAX, YMAX) pnt4 = arcpy.Point(XMAX, YMIN) array = arcpy.Array() array.add(pnt1) array.add(pnt2) array.add(pnt3) array.add(pnt4) array.add(pnt1) polygon = arcpy.Polygon(array) #select features that intersect polygon arcpy.SelectLayerByLocation_management("Airports", "INTERSECT", polygon)
... View more
12-12-2013
05:18 AM
|
0
|
0
|
1462
|
|
POST
|
Can you upload a sample of your .txt file you are working with?
... View more
12-12-2013
02:36 AM
|
0
|
0
|
4409
|
|
POST
|
You can iterate through the fields and only search the permit fields. Ex: fc = "permits" for field in arcpy.ListFields(fc): #Specify all none permit fields if field.name != "OBJECTID" and field.name != "Shape" and field.name != "Shape_Length" and field.name != "Shape_Area" and field.name != "GlobalID" and field.name != "HasPermit": with arcpy.da.UpdateCursor(fc, [field.name, "HasPermit"], "NOT " + field.name + " IS NULL") as cursor: #if query is valid, set hasValue variable to 'true' hasValue = 'true' if hasValue == 'true': for row in cursor: row[1] = "YES" cursor.updateRow(row) hasValue = 'false' del cursor, row
... View more
12-12-2013
02:34 AM
|
0
|
0
|
1036
|
|
POST
|
As a test, try setting your env.workspace to another directory, i.e. r"C:\temp".
... View more
12-11-2013
11:15 AM
|
0
|
0
|
4409
|
|
POST
|
Hi Nathan, Unfortunately, the behavior you are experiencing is "as-designed." However, the visibility can be set as desired in a new layer created using MakeFeatureLayer. Essentially what you need to do is create a Feature Layer with the desired field visibility, remove the original layer from the map, and then add the feature layer. This is a bit cumbersome, however an enhancement request has been logged: [#NIM087522 Please allow field visibility to be changed in an existing map layer.]
... View more
12-11-2013
11:14 AM
|
0
|
2
|
6408
|
|
POST
|
Hi Ben, When specifying absolute paths, be sure to specify an 'r' before hand. Ex: env.workspace = r"C:\Users\mbs7038\Documents\ArcGIS\matDEM" However, once you have the env.workspace set, you can read/write data from this workspace without specifying the entire path. Ex: arcpy.CopyFeatures_management(saved_Layer, "ElevPts.shp") Try the following: import arcpy
from arcpy import env
# Set environment settings
env.workspace = r"C:\Users\mbs7038\Documents\ArcGIS\matDEM"
try:
# Set the local variables
in_Table = "LatLonElev.txt"
x_coords = "Lon"
y_coords = "Lat"
z_coords = "Elev"
out_Layer = "ElevPts_layer"
saved_Layer = "ElevPts.lyr"
# Set the spatial reference
spRef = r("GCS_WGS_1984")
# Make the XY event layer
arcpy.MakeXYEventLayer_management(in_Table, x_coords, y_coords, out_Layer, spRef, z_coords)
# Save to a layer file
arcpy.SaveToLayerFile_management(out_Layer, saved_Layer)
#===============================================================================
# Copy features to shapefile
arcpy.CopyFeatures_management(saved_Layer, "ElevPts.shp")
#===============================================================================
except:
# If an error occurred print the message to the screen
print arcpy.GetMessages()
... View more
12-11-2013
10:32 AM
|
0
|
0
|
4409
|
|
POST
|
Hi Justin, You could use the following:
fc = "permits"
with arcpy.da.UpdateCursor(fc, ["Permit1", "Permit2", "HasPermit"], "NOT Permit1 IS NULL OR NOT Permit2 IS NULL") as cursor:
for row in cursor:
row[2] = "YES"
cursor.updateRow(row)
del cursor, row What the code does is search through the permit fields (i.e. Permit1, Permit2) and if any of them have a value it will populate the 'HasPermit' field with a value of YES. If your data does not have NULL values, you will have to update the query to: NOT Permit1 = '' OR NOT Permit2 = ''
... View more
12-11-2013
09:52 AM
|
0
|
0
|
1036
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-08-2026 12:27 PM | |
| 4 | 05-07-2020 05:14 PM | |
| 1 | 03-25-2026 04:16 AM | |
| 1 | 03-16-2026 01:00 PM | |
| 1 | 12-22-2025 10:39 AM |
| Online Status |
Offline
|
| Date Last Visited |
Friday
|