|
POST
|
Try taking out the space before your filename. Other than that, I think the 'wb' option might depend on your version of python, and possibly operating system. I'm using 2.6.5 on Windows 2008, but actually I was going off examples from 2.7. I see posts from 2.6 users who say to use 'w', so maybe try that.
... View more
06-16-2011
07:42 AM
|
0
|
0
|
5714
|
|
POST
|
You can use one of my favourite tools, Feature to Line, to make a lot of useful changes to road files. Set the XY Tolerance as low as possible, while still making the changes you want.
... View more
06-15-2011
01:32 PM
|
0
|
0
|
2085
|
|
POST
|
It sounds like it's going to be painful no matter what you do, but you might find some inspiration with the Snap tool (make a copy first).
... View more
06-15-2011
12:15 PM
|
0
|
0
|
2085
|
|
POST
|
Do you want distances between pairs of points along the stream, or between every pair of points in the feature class? You should check out the Near tool for 2D distances (requires ArcInfo license), or Near 3D for 3D distances (requires 3D Analyst). Aside from that, it would be a relatively simple python script to loop through all points and calculate the distances from the coordinates.
... View more
06-15-2011
12:09 PM
|
0
|
0
|
623
|
|
POST
|
In the code block: If [QR] > 0.8 then
result = "High"
elseif [QR] > 0.6 then
result = "Good"
elseif [QR] > 0.4 then
result = "Moderate"
else
result = ""
end if
In the expression: result
... View more
06-14-2011
11:02 AM
|
0
|
0
|
2493
|
|
POST
|
Your first line is trying to assign a value of "greater than or equal to 0.4" to the field [QR]. I assume what you mean is "[QR] is equal to 0.4" or: [QR] = 0.4
... View more
06-14-2011
10:03 AM
|
0
|
0
|
2493
|
|
POST
|
This code will create and write to a new csv file. Unfortunately, it delimits every character, and I haven't figured out how to fix that. If you do, please post how. import arcpy, csv
mxd = arcpy.mapping.MapDocument("YOUR MXD HERE")
layers = arcpy.mapping.ListLayers(mxd)
filepath = "NEW CSV FILE PATH HERE"
writer = csv.writer(file(filepath, 'w'))
for layer in layers:
if layer.supports("dataSource"):
writer.writerow(layer.dataSource)
del writer EDIT: this works import arcpy, csv
mxd = arcpy.mapping.MapDocument("YOUR MXD HERE")
layers = arcpy.mapping.ListLayers(mxd)
filepath = "NEW CSV FILE PATH HERE"
writer = csv.writer(file(filepath, 'wb'))
sourcelist = []
for layer in layers:
if layer.supports("dataSource"):
sourcelist.append(layer.dataSource)
writer.writerow(sourcelist)
del writer
... View more
06-14-2011
08:58 AM
|
0
|
0
|
5714
|
|
POST
|
VB allows you to dim as a datatype. VBScript doesn't. Delete "as string".
... View more
06-14-2011
08:01 AM
|
0
|
0
|
2493
|
|
POST
|
The problem is that your "for" is indented. You only indent after the colon (ie. after the "for").
... View more
06-14-2011
07:58 AM
|
0
|
0
|
1154
|
|
POST
|
I'm not sure about printing (can't test here), but this will list the data source of each layer (help here) in a mxd (you can just as easily print the layer name): import arcpy
mxd = arcpy.mapping.MapDocument("MXD PATH HERE")
layers = arcpy.mapping.ListLayers(mxd)
for layer in layers:
if layer.supports("dataSource"): # some layers might not support the property "dataSource"
print layer.dataSource
... View more
06-13-2011
02:31 PM
|
1
|
1
|
5714
|
|
POST
|
You should try selecting both lines and see if there are two (or more) records selected in your attribute table. This would indicate that there is duplicate geometry, as suggested in another thread.
... View more
06-13-2011
01:25 PM
|
0
|
0
|
1280
|
|
POST
|
If you post the code inside tags (see above the text box when posting), we can see your indentation (which is important in Python, btw).
... View more
06-13-2011
12:47 PM
|
0
|
0
|
1154
|
|
POST
|
Did you press F2 to finish your sketch in between screen shots? If not, give it a try.
... View more
06-13-2011
12:14 PM
|
0
|
0
|
1280
|
|
POST
|
I agree with Mark. Instead of downloading a contour shapefile, find a digital elevation model (DEM) and either symbolize it according to elevation, or create contours from it, or both (personally, I often like seeing both).
... View more
06-13-2011
10:49 AM
|
0
|
0
|
917
|
|
POST
|
You can find extend and trim tools on the Advanced Editing Toolbar.
... View more
06-13-2011
08:53 AM
|
0
|
0
|
3387
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-30-2013 02:22 PM | |
| 1 | 04-12-2011 11:19 AM | |
| 1 | 09-17-2021 09:43 AM | |
| 1 | 04-04-2012 12:05 PM | |
| 2 | 07-16-2020 11:31 AM |
| Online Status |
Offline
|
| Date Last Visited |
07-15-2023
12:11 AM
|