|
POST
|
Or do you want to Locate Features Along Routes after you have created the points? ArcGIS Help 10.1
... View more
07-09-2015
10:25 AM
|
0
|
1
|
3906
|
|
POST
|
Option 1: I want to create a new point along Hood every 50', so that the point created at the start of Hood is given the value of 566, and the next point is created 50' farther, with a value of 570 or so. So the 570 value would be added to the attribute table and the 570 values is the straight line distance between the newly created interval point and the point of origin of the line?
... View more
07-09-2015
10:18 AM
|
0
|
3
|
3906
|
|
POST
|
Can't you accomplish that task using the Spatial Join tool in ArcToolbox, then export the resulting table to a CSV file?
... View more
07-09-2015
07:58 AM
|
0
|
0
|
1524
|
|
POST
|
Here is an updated version of my Find and Delete Spatially Duplicate Records in a Shapefile. This code works in ArcGIS 10.1+ and does not require and advance license, it works on any feature class, and it runs much faster relying on geometry and not selections. The geometry compare only uses X and y and not z values, sorry but the method comes that way from ESRI. There is no consideration of the attribute table but the tool preserves the original FC. try:
print "Find And Delete Spatially Duplicate Records in a Feature Class..."
print "A Two-Bit Algorithms product\nby Gerry Gabrisch (geraldg@lummi-nsn.gov)"
print "Copy?Right! 2015...Free to hack with with attribution."
import sys, traceback, time
import arcpy
from arcpy import env
env.overwriteOutput = True
#the input FC with duplicate records....
inFC= r"C:\gTemp\Converted_Graphics.shp"
#The output FC that will have duplicate records purged....
outFC = r"C:\gTemp\Converted_GraphicsTEST.shp"
arcpy.CopyFeatures_management(inFC, outFC)
with arcpy.da.SearchCursor(inFC, ["OID@", "SHAPE@"]) as cursor:
for row in cursor:
with arcpy.da.UpdateCursor(outFC, ["OID@", "SHAPE@"]) as cursor2:
dupcount = 0
for row2 in cursor2:
if cursor[1].equals(cursor2[1]):
dupcount +=1
if dupcount >=2:
dupcount = 1
cursor2.deleteRow()
except arcpy.ExecuteError:
print "error"
msgs = arcpy.GetMessages(2)
arcpy.AddError(msgs)
print msgs
except:
print "error"
tb = sys.exc_info()[2]
tbinfo = traceback.format_tb(tb)[0]
pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1])
print pymsg + "\n"
... View more
06-09-2015
09:11 AM
|
1
|
0
|
1122
|
|
POST
|
Here is code that will sift though a directory (and all sub directories) and create a convex hull for all GIS data. The convex hulls are written to a new feature class. You can then add the feature class to an ArcMap project and see all the data that covers your area of interest. The output feature class contains an attribute listing the path to the data. try:
print "Create Convex Hulls for All Vector Data..."
print "Created by Gerry Gabrisch (geraldg@lummi-nsn.gov)"
print "Copy?Right! Lummi Indian Business Council 10-1-2013"
import arcpy, math, os, sys, traceback, winsound
winsound.Beep(1000,500)
winsound.Beep(2500,500)
inDir = "Z:\\Data"
appendeddata = "C:\gtemp\DataExtentsZData.shp"
arcpy.env.overwriteOutput = True
datapaths = []
def GetBoundingGeometry(inFC,datapaths):
outFeatureClass = "C:\\gtemp\\convexhulltemp2.shp"
appendeddata = "C:\gtemp\DataExtentsZData.shp"
try:
arcpy.MinimumBoundingGeometry_management(inFC, outFeatureClass,"CONVEX_HULL", "ALL")
arcpy.Append_management(outFeatureClass, appendeddata, "NO_TEST","","")
desc = arcpy.Describe(inFC)
datapaths.append(desc.catalogPath)
except:
pass
for root, dirs, files in os.walk(inDir):
print "working in ", root
#Get all geodatabase feature classes and feature dataset feature classes...
if root.endswith(".gdb"):
arcpy.env.workspace = root
FeatureClasses = arcpy.ListFeatureClasses("*", "All")
for features in FeatureClasses:
desc = arcpy.Describe(features)
GetBoundingGeometry(features, datapaths)
datasets = arcpy.ListDatasets("*", "FEATURE")
for dataset in datasets:
arcpy.env.workspace = root + "\\" + dataset
FeatureClasses = arcpy.ListFeatureClasses("*", "All")
for features in FeatureClasses:
GetBoundingGeometry(features, datapaths)
else:
arcpy.env.workspace = root
FeatureClasses = arcpy.ListFeatureClasses("*", "All")
for features in FeatureClasses:
desc = arcpy.Describe(features)
if desc.dataType == "CoverageFeatureClass":
pass
else:
GetBoundingGeometry(features, datapaths)
rows = arcpy.UpdateCursor(appendeddata)
counter = 0
for row in rows:
row.filepath = datapaths[counter]
counter += 1
rows.updateRow(row)
print "done"
winsound.Beep(2500,1000)
except arcpy.ExecuteError:
msgs = arcpy.GetMessages(2)
arcpy.AddError(msgs)
print msgs
except:
tb = sys.exc_info()[2]
tbinfo = traceback.format_tb(tb)[0]
pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1])
msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages(2) + "\n"
arcpy.AddError(pymsg)
arcpy.AddError(msgs)
print pymsg + "\n"
print msgs
... View more
06-02-2015
09:53 AM
|
1
|
0
|
1258
|
|
POST
|
The output file name needs a '.shp' maybe? output_layer = "C:\\Users\\Fred\\Desktop\\GIS\\ModelBuilder Project\\TEST\\test" + str(thectr) +".shp"
... View more
02-12-2015
04:30 PM
|
0
|
1
|
9676
|
|
POST
|
Have you tried making a TIN from the points? If you have shorelines, use those as hard break lines so the TIN does not "take short cuts.
... View more
01-29-2015
03:21 PM
|
0
|
0
|
1812
|
|
POST
|
Here is an ArcToolbox version of the script above that works in 10.1 and ought to work in any version of 10.1 or later. ftp://lnnr.lummi-nsn.gov/GIS_Scripts/MinimumColorMap.zip ftp://lnnr.lummi-nsn.gov/GIS_Scripts/
... View more
01-26-2015
10:59 AM
|
0
|
0
|
831
|
|
POST
|
Kim, you can symbolize any distribution of polygons with a four color map such that no two colors touch. below is some code that will create a new attribute called fourcolor. You can symbolized off of the resulting values. You will have the change the path to the inFC dataset to point to your data. See here for more information....ESRI Mapping Centre - Maps: Los Angeles Ethnicity Here is an ESRI four-color tool but I do not know if it will work with your version of ArcGIS Esri Mapping Centre - ArcGIS Resources Good luck. try: print"Minimum Color Map" print "Copyright 2011, Gerry Gabrisch\n" import arcpy, os, sys, string, traceback, operator inFC = r"On-Reservation Clam Harvest Areas" print "Creating a minimum color map for "+ inFC print "Adding field 'FourColor...'" listoffields = [] for field in arcpy.ListFields(inFC): listoffields.append(field.name) if 'GerryTemp' not in listoffields: arcpy.AddField_management(inFC, "GerryTemp", "SHORT") if 'FourColor' not in listoffields: arcpy.AddField_management(inFC, "FourColor", "SHORT") del listoffields counter = 0 rows = arcpy.UpdateCursor(inFC) for row in rows: row.GerryTemp = counter rows.updateRow(row) counter +=1 listofconnections = [] g1 = arcpy.Geometry() geometrylist1 = arcpy.CopyFeatures_management(inFC, g1) g2 = arcpy.Geometry() geometrylist2 = arcpy.CopyFeatures_management(inFC, g2) print "Sorting...Please wait..." counter1 = 0 for geometry1 in geometrylist1: connection = [] connection.append(counter1) counter = 0 for geometry2 in geometrylist2: #connection.append(counter) if (geometry1.touches(geometry2) or geometry1.overlaps(geometry2)) and counter != counter1: connection.append(counter) counter +=1 counter1 += 1 listofconnections.append(connection) #sort the list based on the elements (more lists) by length listofconnections = sorted(listofconnections, key = len, reverse = True) iscolor1 = [];iscolor2 = [];iscolor3 =[];iscolor4 = [] cantbecolor1 =[];cantbecolor2 =[];cantbecolor3 =[]; cantbecolor4 =[] counter = 0 for item in listofconnections: #Set the polygon with the largest number of neighbors to color #1 if counter == 0: iscolor1.append(item[0]) counter2 = 0 for item2 in item: if counter2 > 0: cantbecolor1.append(item2) counter2 += 1 #For any disconnected polygons, give them a value of 4 elif len(item) == 1: iscolor4.append(item[0]) counter2 = 0 for item2 in item: if counter2 > 0: cantbecolor4.append(item2) counter2 += 1 #For any remaining polygons, sort out the colors... else: if item[0] not in cantbecolor1: iscolor1.append(item[0]) counter2 = 0 for item2 in item: if counter2 > 0: cantbecolor1.append(item2) counter2 += 1 elif item[0] not in cantbecolor2: iscolor2.append(item[0]) counter2 = 0 for item2 in item: if counter2 > 0: cantbecolor2.append(item2) counter2 += 1 elif item[0] not in cantbecolor3: iscolor3.append(item[0]) counter2 = 0 for item2 in item: if counter2 > 0: cantbecolor3.append(item2) counter2 += 1 else: iscolor4.append(item[0]) counter2 = 0 for item2 in item: if counter2 > 0: cantbecolor4.append(item2) counter2 += 1 counter += 1 print "Writing color codes to the attribute table..." rows = arcpy.UpdateCursor(inFC) for row in rows: if row.GerryTemp in iscolor1: row.FourColor = 1 if row.GerryTemp in iscolor2: row.FourColor = 2 if row.GerryTemp in iscolor3: row.FourColor = 3 if row.GerryTemp in iscolor4: row.FourColor = 4 rows.updateRow(row) arcpy.DeleteField_management(inFC, "GerryTemp") print "All done." except arcpy.ExecuteError: msgs = arcpy.GetMessages(2) arcpy.AddError(msgs) print msgs except: tb = sys.exc_info()[2] tbinfo = traceback.format_tb(tb)[0] pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1]) msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages(2) + "\n" arcpy.AddError(pymsg) arcpy.AddError(msgs) print pymsg + "\n" print msgs
... View more
01-23-2015
11:16 AM
|
0
|
1
|
831
|
|
POST
|
And you can use HTML tags to format the item description for a nicer looking tool.
... View more
01-15-2015
07:48 AM
|
0
|
0
|
2233
|
|
POST
|
But you need to have the tabular data converted to vector data firs,t and to do that use Make XY Event Layer in ArcToolbox. 1. Convert your tabular data to vector data. 2. Create your TIN or terrain as you see fit. 3. Use the geoprocessing tools in ArcToolbox to generate a slope surface.
... View more
10-23-2014
11:32 AM
|
1
|
1
|
3095
|
|
POST
|
Oh, and about the elevation under stream bank problem. Unless you know where these areas are and surveyed them and created a new surface model based on these data you are out-of-luck and stuck with the original surface model.
... View more
10-23-2014
10:50 AM
|
0
|
0
|
1665
|
|
POST
|
Paul, Here is a link to a number of tool to create relative surface models. There are tools to detrend by transects, Euclian planes, Voronoi polygons... I would give detrend by transect a try first. White if you have troubles or questions. ftp://lnnr.lummi-nsn.gov/GIS_Scripts/DetrendingTools.zip
... View more
10-23-2014
10:46 AM
|
0
|
2
|
1665
|
|
POST
|
James, Assuming you have all the tiffs in one directory, and assuming the tiff file names are of the same length, you could sift through all the files in the folder, find which files were winter months, create a list of those file names, and then execute you code after the list of file names is complete. This gets the file names, splits and slices out the month, and writes the file name to a new list.
import os
indir = ""#YOUR DIRECTORY OF TIFFS
#Create an empty list to store all the file names for winter months....
listofdatatoprocess = []
#Get the files in the directory....
for root, directories, files in os.walk(indir):
for filename in files:
filenamesplit = filename.split(".")
#extract the month...
month = filenamesplit[0][31:33]
if month == '11' or month == '12' or month == '01' or month == '02' or month == '03':
listofdatatoprocess.append(filename)
for item in listofdatatoprocess:
#YOUR CODE HERE
... View more
10-22-2014
01:33 PM
|
1
|
4
|
1710
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-26-2025 08:30 AM | |
| 1 | 10-29-2024 03:51 PM | |
| 1 | 06-26-2024 08:32 AM | |
| 1 | 12-06-2023 11:53 AM | |
| 1 | 06-12-2012 07:42 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2025
02:21 PM
|