|
POST
|
You could accomplish this by intersecting the sites and floodplain layer, perform a join and then calculate the percent coverage using the 'Shape_Area' fields. Here is an example: import arcpy
from arcpy import env
env.workspace = r"C:\temp\python\test.gdb"
env.overwriteOutput = True
fc1 = "DevelopmentSites"
fc2 = "FloodPlain"
# Add field to DevelopmentSites
arcpy.AddField_management(fc1, "Percentage", "Double")
# Perform an intersect between DevelopmentSites & FloodPlain feature classes
arcpy.Intersect_analysis([[fc1], [fc2]], "Intersect")
# Join intersecting feature class with DevelopmentSites
arcpy.MakeFeatureLayer_management(fc1, "development_layer")
arcpy.AddJoin_management("development_layer", "OBJECTID", "Intersect", "FID_DevelopmentSites")
# Calculate Percentage of flood plain coverage
arcpy.CalculateField_management("development_layer", "DevelopmentSites.Percentage", "!Intersect.Shape_Area! / !DevelopmentSites.Shape_Area! * 100", "PYTHON")
# Delete Intersect feature class
arcpy.Delete_management("Intersect") The result will be a new field called 'Percentage' within the DevelopmentSites feature class with the percent coverage of the flood plain feature class.
... View more
09-13-2011
08:49 AM
|
0
|
0
|
1780
|
|
POST
|
I was able to compare two annotation feature classes using the Shape fields. Below is an example of the code I used: fc = "AirportsAnno"
fc2 = "AirportsAnno_1"
y = str(arcpy.GetCount_management(fc))
x = 1
while x <= int(y):
rows = arcpy.SearchCursor(fc, "OBJECTID = " + str(x))
rows2 = arcpy.SearchCursor(fc2, "OBJECTID = " + str(x))
for row in rows:
geom = row.shape
for row2 in rows2:
geom2 = row2.shape
if geom.equals(geom2):
print "OBJECTID " + str(row.OBJECTID) + " matches"
else:
print "OBJECTID " + str(row.OBJECTID) + " does not match"
x += 1
del row, rows, row2, rows2 I tested this on the annotation feature class when a feature's text was updated, and when the annotation was moved. In both cases the script reported that the features do not match.
... View more
09-13-2011
04:27 AM
|
0
|
0
|
705
|
|
POST
|
If I am understanding you correctly, you are trying to sum the two distance fields from 'Table_2' & 'Table_3' and show the sum in 'Table_1'. To do this, you can add a new field to 'Table_1' called 'Distance' and then use a python script to update this field by summing the Distance fields from 'Table_2' & 'Table_3'. Here is an example on how to do this: import arcpy, os
from arcpy import env
env.workspace = r"C:\temp\python\test.gdb"
env.overwriteOutput = True
# Add Distance field if it does not exist
lstFields = arcpy.ListFields("Table_1")
for field in lstFields:
if field.name == "Distance":
""
else:
arcpy.AddField_management("Table_1", "Distance", "Double")
# Join tables
arcpy.MakeTableView_management("Table_1", "Table_1_View")
arcpy.AddJoin_management("Table_1_View", "Name_ID", "Table_2", "Name_ID")
arcpy.AddJoin_management("Table_1_View", "Table_1.Name_ID", "Table_3", "Name_ID")
# Update Distance field
arcpy.CalculateField_management("Table_1_View", "Table_1.Distance", "!Table_2.Distance! + !Table_3.Distance!" , "PYTHON")
print "Successful"
... View more
09-12-2011
04:02 AM
|
0
|
0
|
590
|
|
POST
|
You can add a domain to a feature class without creating a subtype. If your feature class has a subtype, the domain must be applied at the subtype level. If it has no subtype, you can apply the domain directly to the field(s). Take a look at the following links on how to create a domain and apply it to a feature class: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//001s00000004000000.htm http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Associating_default_values_and_domains_with_tables_and_feature_classes/001s00000009000000/
... View more
09-08-2011
10:41 AM
|
0
|
0
|
2006
|
|
POST
|
Relationship classes can only be created in the same geodatabase that contains the feature classes or tables. Therefore, the feature class, relationship class, and attachment table must reside in the same geodatabase.
... View more
09-08-2011
09:52 AM
|
0
|
0
|
654
|
|
POST
|
Open ArcMap and take a look at the very top left corner. It should read something similar to: Untitiled - ArcMap - ArcView Untitled = Map Document Name ArcMap = Product ArcView = License level Or you can go to Help > About ArcMap. This should also list the license type. If you are using ArcView you will not have the ability to create a geodatabase topology. There are 3 license levels for ArcGIS Desktop: ArcView, ArcEditor, and ArcInfo. You will need at least an ArcEditor license to create a geodatabase topology.
... View more
09-08-2011
08:04 AM
|
0
|
0
|
1578
|
|
POST
|
You can select all of the feature classes under the Contents tab within ArcCatalog and it will give you a count at the lower left of all the feature classes selected. However, this will not include feature classes within feature datasets. To get a count of both you may need to result to a python script. I've attached one here that you can use. Browse to the toolbox in the Catalog window, double-click the script within the Toolbox, and then browse to the File Geodatabase. The script will report how many feature classes exist within the geodatabase.
... View more
09-08-2011
07:31 AM
|
0
|
0
|
3475
|
|
POST
|
I highly recommend the class 'Introduction to Geoprocessing Scripts Using Python'. It gives a great overview of using python with ArcGIS and the new Esri-developed Python site package Arcpy.
... View more
09-02-2011
09:17 AM
|
0
|
0
|
3156
|
|
POST
|
You could write something similar to the code below. You will probably have to add a try/except clause to pass feature classes that do not contain the corresponding fields. import arcpy
from arcpy import env
env.workspace = r"C:\temp\python\test.gdb"
lstFCs = arcpy.ListFeatureClasses("*")
for fc in lstFCs:
rows = arcpy.UpdateCursor(fc)
try:
for row in rows:
if row.Value >= 0.0 and row.Value <= 0.2:
row.Class = 1
if row.Value > 0.2 and row.Value <= 0.4:
row.Class = 2
if row.Value > 0.4 and row.Value <= 0.6:
row.Class = 3
if row.Value > 0.6 and row.Value <= 0.8:
row.Class = 4
if row.Value > 0.8 and row.Value <= 1.0:
row.Class = 5
if row.Value > 1.0 and row.Value <= 1.2:
row.Class = 4
if row.Value > 1.2 and row.Value <= 1.4:
row.Class = 3
if row.Value > 1.4 and row.Value <= 1.6:
row.Class = 2
if row.Value > 1.6 and row.Value <= 2.0:
row.Class = 1
rows.updateRow(row)
except RuntimeError:
pass
del row, rows
... View more
09-02-2011
08:11 AM
|
0
|
0
|
2145
|
|
POST
|
You can use the python open function to accomplish this. You could write to a text file whether a script/tool was executed successfully or not. Below is an example. If the text file does not exist, it will automatically be created. import arcpy, os
from arcpy import env
env.workspace = r"c:\temp\python\test.gdb"
outtable = open(r"C:\temp\results.txt", "w")
try:
arcpy.FeatureClassToFeatureClass_conversion("Airports", env.workspace, "Airports2")
outtable.write("Converted successfully")
except arcpy.ExecuteError:
outtable.write(arcpy.GetMessages())
outtable.close()
... View more
09-02-2011
07:25 AM
|
0
|
0
|
3156
|
|
POST
|
By default, ArcSDE for Oracle stores text fields as nvarchar2. The maximum size for nvarchar2 is 2000. When a field is larger than 2000, SDE will convert the field to NCLOB. To avoid this issue you will need to update your dbtune table so that text fields will be converted to varchar2 rather than nvarchar2. To do this, export your dbtune table to a text file. Ex: sdetable -o export -f c:\temp\dbtune.txt -i sde:oracle11g -u sde -p sde@orcl Add a parameter UNICODE_STRING with a string value of FALSE under the DEFAULTS keyword. Save the text file and re-import into SDE: sdetable -o import -f c:\temp\dbtune.txt -i sde:oracle11g -u sde -p sde@orcl Now you can import tables into SDE with text fields of size 4000 and it will be varchar2 rather than NCLOB. Here is some further information on this: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002n00000067000000
... View more
09-01-2011
12:19 PM
|
1
|
0
|
6153
|
|
POST
|
You won't be able to add the point as a graphic, but you can add it as a shapefile/feature class using the PointGeometry class and the CopyFeatures_management function. Here is an example: import arcpy
from arcpy import env
env.outputCoordinateSystem = r"Coordinate Systems\Geographic Coordinate Systems\World\WGS 1984.prj"
env.workspace = r"C:\temp\python\test.gdb"
point = arcpy.Point(-97.36, 101.56)
pointGeometry = arcpy.PointGeometry(point)
arcpy.CopyFeatures_management(pointGeometry, "Hydrant")
... View more
09-01-2011
11:03 AM
|
0
|
0
|
1859
|
|
POST
|
You can do this by specifying an index value. Say, for example, you want to select the data frame called 'Philadelphia', and it's the 3rd data frame in your MXD. You would use the following: df = arcpy.mapping.ListDataFrames(mxd)[2] The first data frame in your MXD starts with index 0. Here is some further information: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s30000001p000000.htm
... View more
08-29-2011
11:55 AM
|
0
|
0
|
1655
|
| Title | Kudos | Posted |
|---|---|---|
| 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 | |
| 1 | 01-20-2026 04:04 AM |
| Online Status |
Online
|
| Date Last Visited |
8 hours ago
|