|
POST
|
Instead of generating the trapezoids, you could probably get away with a convex hull on a dissolve of the two buffered points too.
... View more
01-24-2011
08:50 AM
|
0
|
0
|
2730
|
|
POST
|
Arcpy is built on arcgisscripting, which is in turn a CPython extension. You will no be able to use arcpy in IronPython.
... View more
01-18-2011
10:38 AM
|
0
|
0
|
759
|
|
POST
|
Whoops, meant to put a not in there like if not row.field1: glad it works.
... View more
01-12-2011
04:39 PM
|
0
|
0
|
1005
|
|
POST
|
No quotes on the None: if row.field1 != None: or better (grab empty string AND null values): if row.field1: I used the 'Merge' tool to combine two feature classes (call them FC1 and FC2), and the resulting feature class (FC3) was put into a file geodatabase. I then added new fields to FC3. I want to be able to populate the newly added fields by copying the values from fields that were carried over from FC1 and FC2, and then eventually delete the old fields. I am trying to create a script that will use an update cursor to look at each row, and if there's a value for field1, then it would copy it to field3. If there's no value (aka it's null), then it would copy field2 to field3. However, the script doesn't recognize when there's a null value, and therefore it always copies from field1, even if it's an empty cell (there's never an instance where both field1 and field2 are empty). desc = arcpy.Describe(fc3)
fields = desc.fields
rows = arcpy.UpdateCursor(fc3)
for row in rows:
if row.field1 != "":
row.field3 = row.field1
else:
row.field3 = row.field2
rows.updateRow(row)
del rows When I was testing it out, I modified the code (below) to see what arcpy is seeing, and when there were null values, it returned "None" as the value. desc = arcpy.Describe(fc3)
fields = desc.fields
rows = arcpy.UpdateCursor(fc3)
for row in rows:
if row.field1 != "":
print row.field1
else:
print row.field2
rows.updateRow(row)
del rows I tried fixing it by changing the code to if row.field1 != "None": but it didn't change anything. Any ideas? What am I doing wrong? Thanks!
... View more
01-12-2011
03:54 PM
|
0
|
0
|
1005
|
|
POST
|
Don't quote the first two params: gp.CalculateField_management(TABLE, FIELD, "StrConv([texx],vbUpperCase)", "VB")
... View more
01-06-2011
09:23 AM
|
0
|
0
|
1312
|
|
POST
|
import arcpy
import os
def fcs_in_workspace(workspace):
arcpy.env.workspace = workspace
for fc in arcpy.ListFeatureClasses():
print os.path.join(workspace, fc)
for ws in arcpy.ListWorkspaces():
fcs_in_workspace(os.path.join(workspace, ws))
fcs_in_workspace("C:/Data")
... View more
01-06-2011
08:22 AM
|
2
|
0
|
3816
|
|
POST
|
You need to use the string operator as such: arcpy.SelectLayerByAttribute_management ("hotspots", "NEW_SELECTION", ("'date' = '" + dat + "'")) You may be able to select the full set all at once as well: datelst = ['2002-06-06','2002-06-07','2002-06-08'] dateliststring = ",".join("'%s'" % dat for dat in datelst) arcpy.SelectLayerByAttribute_management ("hotspots", "NEW_SELECTION", ("'date' in (%s)" % dateliststring))
... View more
01-04-2011
03:16 PM
|
0
|
0
|
4761
|
|
POST
|
Are the literal >>>s in your script? If so, that's your problem.
... View more
01-04-2011
12:06 PM
|
0
|
0
|
2119
|
|
POST
|
Yes. The MapDocument class has the activeView property for exactly this.
... View more
01-03-2011
07:39 PM
|
0
|
0
|
2144
|
|
POST
|
What functions do you need? There may very well be a version of the functionality you need for older versions.
... View more
12-20-2010
12:54 PM
|
0
|
0
|
557
|
|
POST
|
This won't work, you're going to need to use the CSV module to look deeper into your data. Yo could do something like this:
import csv
in_file = "hello.csv"
out_file = "hello_fixed.csv"
row_reader = csv.reader(open(in_file, "rb"))
row_writer = csv.writer(open(out_file, "wb"))
first_row = row_reader.next()
row_writer.writerow(first_row)
for row in row_reader:
new_row = [val if val else "N" for val in row] + (["N"] * (len(first_row) - len(row)))
print row, "->", new_row
row_writer.writerow(new_row)
Even though this is plain text, it's pretty tricky to get right without the help of a library.
... View more
12-19-2010
08:48 PM
|
0
|
0
|
6092
|
|
POST
|
tempnum == 0, you can't use = in an if statement. Double equals for equality test.
... View more
12-16-2010
02:22 PM
|
0
|
0
|
700
|
|
POST
|
Geoprocessing tools with no arguments will be immediately executed (no GP dialog) from toolbar buttons. So if you 1. create a toolbox with a single script tool (no parameters) that points to your .py and 2. customize a toolbar and add a script tool, you should essentially get what you're looking for.
... View more
12-02-2010
01:15 PM
|
0
|
0
|
1012
|
|
POST
|
Arcpy is case-sensitive, use arcpy.CreateFeatureclass_management
... View more
12-01-2010
09:27 PM
|
0
|
0
|
980
|
|
POST
|
Try leaving out the quotes: MAP.ExportToPDF(MyMXD, MyPDF, convert_markers=True, embed_fonts=True)
... View more
12-01-2010
10:28 AM
|
0
|
0
|
1694
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-26-2012 02:46 AM | |
| 2 | 01-06-2011 08:22 AM | |
| 1 | 03-25-2014 12:18 PM | |
| 1 | 08-12-2014 09:36 AM | |
| 1 | 03-31-2010 08:56 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:22 AM
|