|
POST
|
I don't think there's any shame in naming the tools "Step 1 - Do This", "Step2 - Do That", etc. Another idea... What about having a single tool that pauses between sections and asks for a user response before continuing?
... View more
01-18-2013
07:28 AM
|
0
|
0
|
2140
|
|
POST
|
Question/comment for recurvata: Why are you dissolving the selected parcels? Why not just use them directly (the feature layer with the selected parcels) to run your SelectByLocation?
... View more
01-17-2013
08:28 AM
|
0
|
0
|
3818
|
|
POST
|
The Extract Values to Points tool seems to work better than the Sample tool these days: http://resources.arcgis.com/en/help/main/10.1/index.html#/Extract_Values_to_Points/009z0000002t000000/ Note that both tools require a Spatial Analyst license.
... View more
01-16-2013
02:55 PM
|
0
|
0
|
593
|
|
POST
|
The 64-bit background theory sounds very plausible - I bet that one will be a common stumbling point for many of us going forward. Dan, you are able to list non-xls tables via arcpy, right? Like tables in a FGDB? If you don't have the 64-bit background gp thing installed... Hmm. I'm out oif ideas... Except for plan Z:Complete uninstall/reinstall of ArcGIS and Office. Install Office 1st, then ArcGIS.
... View more
01-15-2013
07:02 AM
|
0
|
0
|
2603
|
|
POST
|
Maybe a dumb question: Are you sure that the path to your xls file is correct? Strangely, you can set the workspace to a non-existant .xls file with no error, and it will yield of course, an empty table list Make sure the .xls file path exists: import os
os.path.exists(xlsFilePath) It should retern True, otherwise there's you problem.
... View more
01-14-2013
12:22 PM
|
0
|
0
|
2603
|
|
POST
|
I can access .xls files like this in v10.1: >>> import arcpy >>> path = r"\\snarf\am\div_lm\ds\gis\projects\workstations\benchmarks\chris\result_tables\merge_20120904.xls" >>> arcpy.env.workspace = path >>> tableList = arcpy.ListTables() >>> tableList [u'PivotTable$', u'RawData$'] >>> Since the .xls file is treated like a workspace container the script would look something like:
import arcpy
xlsPath = r"\\snarf\am\div_lm\ds\gis\projects\workstations\benchmarks\chris\result_tables\merge_20120904.xls"
fgdbPath = r"C:\temp\test.gdb"
arcpy.env.workspace = xlsPath
tableList = arcpy.ListTables()
for table in tableList:
inTbl = os.path.join(xlsPath,table),
outTbl = os.path.join(fgdbPathm, table[0:-1]) #get rid of the traling '$' symbol
arcpy.CopyRows(inTbl, outTbl) If you want to get fancier, you could use the win32com module to fetch values from the .xls file (or the .xlsx file!) ... Then you could have it all.
... View more
01-14-2013
10:53 AM
|
0
|
0
|
3036
|
|
POST
|
...and do other sorts of everyday tasks such as update feature classes that have more than 100 records. Ha! That's funny... You are very welcome.
... View more
01-14-2013
07:03 AM
|
0
|
0
|
5402
|
|
POST
|
Hmmm.... Try checking the "Unsplit lines (optional)" setting - via a Python script that would be "UNSPLIT_LINES"
... View more
01-11-2013
08:21 AM
|
0
|
0
|
1035
|
|
POST
|
Not sure what's wrong with your code/machine, but there are many ways to skin a shapefile. Personally, I don't like using the env.workspace variable unless I have to (for example, if listing featureclasses in a FGDB). Also, I avoid using CAPS in file/folder names. This code "should" work: import os, arcpy
rootDir = r"D:\pwwild\master"
fgdbName = "master.gdb"
fgdbPath = os.path.join(rootDir, fgdbName)
arcpy.CreateFileGDB_management(rootDir, fgdbName)
shpList = ["cnddb.shp", "cnddbpnt.shp"] # I assume these are in rootDir
for shp in shpList:
inFC = os.path.join(rootDir, shp)
outFC = os.path.join(fgdbPath, shp.split(".")[0])
arcpy.CopyFeatures_management(inFC, outFC)
... View more
01-10-2013
07:45 PM
|
0
|
0
|
1161
|
|
POST
|
Are you specifying "SINGLE_PART" for the dissolve? For whatever reason, ESRI decided to make "MULTI_PART" the default, which causes a lot of issues I think.
... View more
01-10-2013
11:52 AM
|
0
|
0
|
1035
|
|
POST
|
In Python (and using the data access cursor model in ArcGIS v10.1) the code would look like this... Basically a re-write of the 'SUM' functionality of summary statistics tool using da cursors and a Python Dictionary. You would then use an insertCursor to write the values from 'summaryDict' back to a table on disk (not shown) or maybe you could hand the values in the dictionary straight to matplotlib? myTable = r"C:\test.gdb\my_table"
summaryDict = {}
searchRows = arcpy.da.SearchCursor(myTable, ["YEAR","ACRES"])
for searchRow in searchRows:
yearValue, acresValue = searchRow
if yearValue in summaryDict:
summaryDict[yearValue] = summaryDict[yearValue] + acresValue
else:
summaryDict[yearValue] = acresValue
yearKeys = summaryDict.keys()
yearKeys.sort() #sort the years in ascending order
#Print some output
for yearValue in yearKeys:
print str(yearValue) + " = " + str(summaryDict[yearValue]) + " acres"
... View more
01-10-2013
09:37 AM
|
1
|
4
|
3686
|
|
POST
|
Great observation! I had not been setting the SR env variable. Now I will!
... View more
12-18-2012
03:27 PM
|
0
|
0
|
2574
|
|
POST
|
Like Matt said, I too think your Python install is hosed... See how stmplib is "looking" under: C:\Python26\lib\smtplib.py... With ArcGIS properly installed the stmplib library should be located under C:\Python26\ArcGIS10.0\Lib. If you have both a C:\Python26\lib folder and a C:\Python26\ArcGIS10.0 folder I can almost 99.9 % assure you that your Pythoin install is to blame. Not sure why things would all of a sudden start working after a few weeks.... that seems weird, but... As a test, I would recommend on one of your boxes you: 1. Unstall ArcGIS completely 2. Uninstall any and all Python versions including any Python extras like PythonWin. 3. Delete the C:\Program Files\ArcGIS folder. 4. Delete any C:\Python* folders 5. Delete the C:\Users\<usernames>\AppData\Roaming\ESRI folder 6. Reinstall ArcGIS 7. After all that, it "should" be back to normal.
... View more
12-17-2012
11:11 AM
|
0
|
0
|
1397
|
|
POST
|
If you are a "visual learner", I would highly recomend Google's Python tutorials... Probably THE BEST quickstart resource I have seen. https://developers.google.com/edu/python/
... View more
12-17-2012
07:41 AM
|
0
|
0
|
2866
|
|
POST
|
To get my machine to send emails via Python, I had to get our sysadmin people to unblock port 25. Otherwise you can specify another port - for example: def sendEmail(emailServer, login, password, port, to, fro = "", subject="", text="", files=[]):
"""Sends an email using a specified mail server and your username credentials"""
try:
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.Utils import COMMASPACE, formatdate
from email import Encoders
msg = MIMEMultipart()
msg['From'] = fro
msg['To'] = COMMASPACE.join(to)
msg['Date'] = formatdate(localtime = True)
msg['Subject'] = subject
msg.attach(MIMEText(text))
for file in files:
part = MIMEBase('application',"octet-stream")
part.set_payload(open(file,"rb").read())
Encoders.encode_base64(part)
part.add_header('Content-Disposition','attachment; filename="%s"' %os.path.basename(file))
msg.attach(part)
#try to connect to the email server
server = smtplib.SMTP()
server.connect(emailServer, port) #port = 25 or 587 or ?
if login != "" and password != "":
server.ehlo()
server.starttls()
server.ehlo()
server.login(login, password)
server.sendmail(fro,to,msg.as_string())
server.quit()
server.close()
return True
except:
return False
... View more
12-17-2012
07:32 AM
|
0
|
0
|
1397
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 03-25-2014 12:57 PM | |
| 1 | 08-29-2024 08:23 AM | |
| 1 | 08-29-2024 08:21 AM | |
| 1 | 02-13-2012 09:06 AM | |
| 2 | 10-05-2010 07:50 PM |
| Online Status |
Offline
|
| Date Last Visited |
08-30-2024
12:25 AM
|