|
POST
|
As Freddie Gibson says, use tool validation. def updateParameters(self):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
if self.params[1].value == True:
self.params[0].value = arcpy.env.workspace
return 1.) 2.)
... View more
07-13-2015
01:46 PM
|
1
|
2
|
3439
|
|
POST
|
Please post what you found so we have a starting point. edit: I will assume you are looking for a way to use the field calculator (or Calculate Field tool) rather than learning how to use an Update Cursor. I'm guessing the reason Update Cursor works while field calculator does not, is that the field uses the CRS of the layer, while you can specify the CRS of an Update Cursor. I can't say whether simply specifying a different CRS in the Update Cursor will actually yield correct results, but you are free to change it nonetheless.
... View more
07-13-2015
01:04 PM
|
1
|
0
|
2828
|
|
POST
|
Have you since restarted ArcMap? I've received "Error 99999" many times with correct syntax, only for it to work upon restart. For the record, your original syntax is valid (just tested).
... View more
07-13-2015
12:59 PM
|
0
|
0
|
1576
|
|
POST
|
Unfortunatly, I fourd something related to the use or the sursor (updateCursor). is there an easy way to do so? This is confusing. Did you find a solution using updateCursor that is too complicated and you're looking for a simpler solution? If so, post a link to the complicated solution, or better yet, the code itself. If not, please explain further what you are looking for.
... View more
07-13-2015
12:55 PM
|
0
|
11
|
2828
|
|
POST
|
Aside from using ArcObjects with Python, I don't believe text background is directly customizable. At least, not through formatting tags or the TextElement object. As a workaround, you could add a formatted text element to your mxd, then use it as a template for other TextElements.
... View more
07-13-2015
10:42 AM
|
1
|
0
|
4257
|
|
POST
|
I don't know if this is more straight-forward, but it does avoid using Raster to Polygon, which can take a long time. 1.) Create a new raster of just Corn/Soybean crops using the Con tool or a Con statement in Raster Calculator like (set extent environment to match schools or crops layer, as appropriate): Con("crops"==[Soybean Value] | "crops raster"==[Corn Value], "crops") 2.) Euclidean distance on new raster to get distance from all corn/soybean pixels to all other pixels. 3.) Extract Values to Points to transfer distance value to each school point. Of course, all of the above requires Spatial Analyst.
... View more
07-13-2015
09:09 AM
|
1
|
0
|
1109
|
|
POST
|
The DEM (or TIN) will be as detailed as you make it. The more points you collect, the more it has to work with.The interpolation method you choose can make very minor guesses how to behave around your points, but it won't be able to make dramatic new features. Have you considered a LiDAR flight? Whether or not that's feasible in your area or with your budget, I don't know, but for the money it takes to send a human with a GPS you can collect several million elevation points, not to mention other benefits like time, safety, etc.
... View more
07-10-2015
05:44 PM
|
0
|
0
|
3812
|
|
POST
|
It is grabbing the actual value from the row reference, but if the value comes from a numeric field it will be cast as numeric Python data type (int, long, or float, as appropriate), which is quite amazingly different from a Python string, which is actually a sequence (like a list).
... View more
07-10-2015
02:47 PM
|
2
|
0
|
1866
|
|
POST
|
You can't concatenate strings and numbers. To convert numbers to strings, use str(): row[3] = "(" + str(row[2]) + ") - (" + str(row[0]) + ") - (" + str(row[1]) + ") - (01)"
... View more
07-10-2015
02:07 PM
|
2
|
2
|
1866
|
|
POST
|
I suspect the problem is trying to write null values, but haven't tested it. for row in cursor:
if (row[0] != None) and (numIDs < 2):
row[3] = "(" + row[2] + ") - (" + row[0] + ") - (" + row[1] + ") - (01)"
elif (row[0] != None) and (numIDs < 3):
row[3] = "(" + row[2] + ") - (" + row[0] + ") - (" + row[1] + ") - (01)"
row[4] = "(" + row[2] + ") - (" + row[0] + ") - (" + row[1] + ") - (02)"
else:
pass # do nothing and move to next row
cursor.updateRow(row)
... View more
07-10-2015
01:11 PM
|
2
|
4
|
1866
|
|
POST
|
First error: you need a colon after the elif statement. elif (numIds == 2): Second error: I don't believe '&' is a valid Python operator. Use 'and' instead at both places. if (row[0] != None) and (numIDs < 2):
... View more
07-10-2015
11:36 AM
|
3
|
10
|
1866
|
|
POST
|
When you click on the TIF, does it still give you correct values at random places but the symbology is all the same, or not? If it's just the symbology, you can try changing the stretch type in the layer symbology, or apply a mask filter as a function through the Image Analysis window. Other than that, make points from your dBase table (MakeXYEventLayer) and interpolate to make a new DEM.
... View more
07-09-2015
03:46 PM
|
1
|
0
|
1374
|
|
POST
|
Can you explain further exactly how your dBase is organized? Does it have an elevation value for every pixel in your DEM, or is it specific measured points, or something else entirely? I could imagine it being as simple as converting ASCII to Raster (after you convert the dBase to ASCII format), or interpolating between points, but it all really depends on what you've got to work with.
... View more
07-09-2015
03:16 PM
|
0
|
2
|
1374
|
|
POST
|
Not an answer, but I believe this should have worked. It doesn't. It blanks out all the joined fields in the first layer, which has a join: import arcpy
arcpy.env.overwriteOutput = True
mxd = arcpy.mapping.MapDocument('C:/junk/junk_map.mxd')
layers = arcpy.mapping.ListLayers(mxd)
arcpy.CopyFeatures_management(layers[0],'C:/junk/FILE_GDB.gdb/copy')
... View more
07-09-2015
02:41 PM
|
1
|
1
|
3639
|
|
POST
|
Something like this may be useful, although it occurs to me now that you may want to use a dictionary instead of lists: import os, arcpy
pws = "PWS_ID='465'"
files = ['DBP_STAGE2', 'BACTI', 'WTP', ..., 'OFFICE'] # list all file names
layers = ['DBP Stage 2', 'Bacti', 'WTP', ..., 'Office']
symNames = ['DBP2', 'BACTI', 'WTP', ..., 'OFFICE']
root = 'V:\\WATER_FACILITY\\WATER_FACILITY.gdb'
paths = []
for file in files:
path = os.path.join(root, file)
paths.append(path) # now have list of paths
symRoot = 'V:\\Source Water Protection\\PWS_ID_Tool'
symPaths = []
for symName in symNames:
symPath = os.path.join(symRoot, symName) + '.lyr'
symPaths.append(symPath) # now have list of symbol paths
for i in range(len(files)):
arcpy.MakeFeatureLayer_management(paths, layers, pws) # make all the layers
arcpy.ApplySymbologyFromLayer_management(layers, symPaths) # apply the symbologies
Ideally, your files, layers, etc. would have a consistent naming convention (e.g. all DBP2 files had the name 'DBP2', not "DBP_STAGE2', etc.) so you'd only need one list, but you've got to work with what you've got.
... View more
07-09-2015
01:55 PM
|
1
|
1
|
1501
|
| 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
|