|
POST
|
I have had good luck speeding up tools with 64-bit background geoprocessing. http://resources.arcgis.com/en/help/main/10.1/index.html#//002100000040000000
... View more
02-25-2014
08:10 AM
|
0
|
0
|
1536
|
|
POST
|
If you have the bathymetric model of the lake you could use this tool to get a table of areas and volumes at different graduations. ftp://lnnr.lummi-nsn.gov/GIS_Scripts/MultiVolumes10/ Next, use the bathymetric model to generate contour lines at the same graduations. Find the contour that matches your lake levels and use the multivolumes10 output table to get the volumes.
... View more
02-07-2014
10:28 AM
|
0
|
0
|
409
|
|
POST
|
This code will populate an existing attribute with a random number. Run the script. Then, for example, select values less than 0.2 to select about 20% of your points. #Populates an existing attribute with a randomly generated value
try:
import operator, os, random, traceback, sys, arcpy
arcpy.AddMessage("Adding random numbers to an existing attribute.")
arcpy.AddMessage("Copyright 2011, Gerry Gabrisch, gerry@gabrisch.us")
#Path to the feature class.
fc = arcpy.GetParameterAsText(0)
#The Attribute to populate...
attribute = arcpy.GetParameterAsText(1)
uc = arcpy.UpdateCursor(fc)
for row in uc:
x = random.random()
row.setValue(attribute, x)
uc.updateRow(row)
arcpy.AddMessage("Done")
except arcpy.ExecuteError:
msgs = arcpy.GetMessages(2)
arcpy.AddError(msgs)
arcpy.AddMessage(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)
arcpy.AddMessage(pymsg + "\n")
arcpy.AddMessage(msgs)
... View more
02-04-2014
07:48 AM
|
0
|
0
|
7967
|
|
POST
|
Sorry for the problems. I just tested the tool and it runs for me. From the link download the toolbox and the DivideLine.py into a new folder on your computer. Add the toolbox to ArcToolbox and run like any scripting tool.
... View more
12-17-2013
09:18 AM
|
0
|
0
|
430
|
|
POST
|
The tool here creates a new point file without altering the original feature geometries. ftp://lnnr.lummi-nsn.gov/GIS_Scripts/CreatePointsAlongALine/
... View more
12-16-2013
06:32 AM
|
0
|
0
|
2421
|
|
POST
|
Scripts and models can have the parameters coded into them which will give you that message. Don't you see an OK button on the bottom, and if so, what happens when you click it.
... View more
12-06-2013
09:54 AM
|
0
|
0
|
2200
|
|
POST
|
If you developed a script, and you have hard-coded all the parameters like the path to the data, the attribute to populate....then you can click OK and the script will run.
... View more
12-06-2013
09:51 AM
|
0
|
0
|
2200
|
|
POST
|
A series of map at the same extent each showing a different feature in a feature class? Here is some code that will produce a new map for each water sample sites. Each output map is the same extent and only one sample site appears on each output map. Each output map has the title changed based on an attribute and each output map is named after the attribute as well. It would be easy to code this for pdf. The (ham-fisted) code would require some changes...a valid path to your mxd, "WaterSampleSiteMaster" (line 10) is the feature layer in my mxd and SiteID (line 13 and elsewhere) is an attribute in the Water sample site feature class that is used to label the map outputs and the map title. Good Luck. try:
import arcpy, sys, traceback
print "Working..."
mxdPath = r"Z:\GISpublic\GerryG\WaterResources\WaterSampleSiteAutoMap\WaterSampleSiteAutoMap22.mxd"
mxd = arcpy.mapping.MapDocument(mxdPath)
df = arcpy.mapping.ListDataFrames(mxd)[0]
lyr = arcpy.mapping.ListLayers(mxd, "WaterSampleSiteMaster", df)[0]
print lyr.dataSource
theAttribute = "SiteID"
#GetAListOfEachAttribute
listOfAttributes = []
print "Start cursor"
rows = arcpy.SearchCursor(lyr.dataSource)
for row in rows:
listOfAttributes.append(row.getValue(theAttribute))
for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):
if elm.name == 'gbglabeler':
elm = elm
break
for item in listOfAttributes:
GBGquery = '"SiteID" =' + '\''+ item + '\''
print "Working on: ",item
print GBGquery
lyr.definitionQuery = GBGquery
elm.text = "Site: " + item
outputjpg = "Z:\GISpublic\GerryG\WaterResources\WaterSampleSiteAutoMap\SiteMaps\\" + item + ".jpg"
arcpy.RefreshActiveView()
arcpy.mapping.ExportToJPEG (mxd, outputjpg)
print "done"
except arcpy.ExecuteError:
msgs = arcpy.GetMessages(2)
arcpy.AddError(msgs)
#If the error is with the script, or with python, find error and report it to the screen...
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)
... View more
11-12-2013
01:32 PM
|
1
|
0
|
1005
|
|
POST
|
Brian, Thanks for the information. Can you point me in the direction of some online help on the subject?
... View more
11-08-2013
01:48 PM
|
0
|
0
|
505
|
|
POST
|
I have a feature class of sample sites and I would like to generate a map for each sample site. For example, the user would click a hotlink for a map showing sample site 1, a map would open, site 1 would be queried and only site 1 displayed on the map. The user would not have to generate the query. Is this possible? Any help would be appreciated.
... View more
10-11-2013
03:51 PM
|
0
|
3
|
868
|
|
POST
|
Hmmm, Must have been some hang up between Arcpy, Komodo, ArcGIS or Citrix. I tried to save the original mxd, got an error that the file location folder was in use. After shutting ArcMap and Komodo down the original code worked fine.
... View more
08-20-2013
12:18 PM
|
0
|
0
|
817
|
|
POST
|
Thanks for the reply, Matt. I hope you are doing well. Yes, SiteID is an attribute storing text. I tried the field delimeter but that just returned the same text string as the brute force way and nothing showed on the output jpeg. Any other thoughts?
... View more
08-20-2013
12:08 PM
|
0
|
0
|
817
|
|
POST
|
Everything seems to work just fine with the code below except that no features draw in the layer that is being queried. All I want to do is create a jpeg for each record in my geodatabase feature class of point locations. Is there something wrong with my query syntax? I cannot figure it out! try:
import arcpy, sys, traceback
print "Working..."
mxdPath = r"Z:\GISpublic\GerryG\WaterResources\WaterSampleSiteAutoMap\WaterSampleSiteAutoMap2.mxd"
mxd = arcpy.mapping.MapDocument(mxdPath)
df = arcpy.mapping.ListDataFrames(mxd)[0]
lyr = arcpy.mapping.ListLayers(mxd, "WaterSampleSiteMaster", df)[0]
print lyr.dataSource
theAttribute = "SiteID"
#GetAListOfEachAttribute
listOfAttributes = []
print "Start cursor"
rows = arcpy.SearchCursor(lyr.dataSource)
for row in rows:
listOfAttributes.append(row.getValue(theAttribute))
for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):
if elm.name == 'gbglabeler':
elm = elm
print elm.name
break
for item in listOfAttributes:
#GBGquery = "\"" + theAttribute + "\" = " + "'" + item + "'"
GBGquery = '"SiteID" =' + '\''+ item + '\''
print "Working on: ",item
print GBGquery
lyr.definitionQuery = GBGquery
elm.text = "Site: " + item
outputjpg = "Z:\GISpublic\GerryG\WaterResources\WaterSampleSiteAutoMap\SiteMaps\\" + item + ".jpg"
arcpy.RefreshActiveView()
arcpy.mapping.ExportToJPEG (mxd, outputjpg)
print "done"
except arcpy.ExecuteError:
msgs = arcpy.GetMessages(2)
arcpy.AddError(msgs)
#If the error is with the script, or with python, find error and report it to the screen...
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)
... View more
08-20-2013
11:20 AM
|
0
|
5
|
1300
|
|
POST
|
This tool will create a perpendicular line at a user defined length from the center ( or end nodes) of the line. It is not exactly what you want but the code is a starting point to solving your problem. ftp://lnnr.lummi-nsn.gov/GIS_Scripts/createperpendicularlines.zip
... View more
07-29-2013
07:24 AM
|
0
|
2
|
2806
|
|
POST
|
Do you need to have a randomly shaped polygon of a specific size? If so, that would require some programming. What if you create a fishnet of rectangular polygons (using the create fishnet tool in Toolbox, and a new attribute (type double) for the fishnet, populate the new attribute with random values, figure out your sample size, then select that many polygons from the fishnet?
... View more
07-29-2013
07:08 AM
|
0
|
0
|
1056
|
| 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 |
a month ago
|