POST
|
How can I programmatically discover if an image has a color map? The properties pop up will tell me if a color map is present, and the raster band ArcObject had a colormap property, but I cannot find any way Python will report the presence of a colormap.
... View more
05-02-2022
07:42 AM
|
0
|
0
|
308
|
POST
|
I would suggest that if wsp == ("*.sde"): is not a useful test. perhaps if wsp.endswith('.sde'): would serve better It is, by the way, perfectly fine to test a boolean baldly, as in: if True: do something
... View more
07-02-2014
10:26 AM
|
0
|
0
|
419
|
POST
|
Or, if you are using an older (<= 10.1) Arc, you can use the python os.walk for root, dirs, files in os.walk(basePathVariable):
print "%s, " % (root)
print str(sum(getsize(join(root, name)) for name in files))
print " bytes, %s files\n" % (len(files)) prints the number and size of non-directory files in each directory and subdirectory. Not exactly what you want to do, but you can get where you want to go from there...
... View more
07-02-2014
10:16 AM
|
0
|
0
|
1163
|
POST
|
Given the error message, I would first check to make sure that the data I believe to be in Mercator actually is. Comparing it's position to other Mercator projected data is a good first step. Next, does the data indeed fall in a region appropriate for that zone of your target projection? Can you successfully project the data to other, similar coordinate systems? You write that you cannot see anything; are there any rows in the attribute table? Does the preview in ArcCatalog show any features?
... View more
07-01-2014
09:43 AM
|
0
|
0
|
2019
|
POST
|
You have to create a Weighted Sum Table to input into Weighted Sum, as you know. These are three item lists, nested in an overall list. to wit: WSTable ([[inRaster, field, weight],...]) Even for just a few rasters, that is a lot of command parameters for a user to enter. It might be better to have the user create a weight parameter text file, say, comma delimited, with one raster per line. for example: inRaster1, field, weight inRaster2, field, weight inRaster3, field, weight ... Then, if the user enters the weight parameter text file (with path) as the command parameter, the script can first find, read, and parse the text file into the Weighted Sum Table format that Weighted Sum requires. That is pretty stratightforward. # make an empty master file
WSTable = []
# open the file to read
txt = open(r"c:\weights.txt", 'r')
# read each line to the end of the file
while txt.readline() != '':
# readline gets a line
line = f.readline()
# rstrip removes carrige return
strip = line.rstrip()
# split makes sure you get the correct chunks
split = strip.split(',')
# now make a list of the chunks
aList = list(split)
# append the individual list to the master list
WSTable.append(aList)
# close the file
txt.close() This can, of course, be very much more succinct furthermore, no warranties are expressed or inplied
... View more
06-27-2014
03:55 AM
|
0
|
0
|
400
|
POST
|
question 1: df = arcpy.mapping.ListDataFrames(, mxd, "Layers")[0] ListDataFrames, as the name implies, returns a list in this case of all data frames named "Layers" The [0] assigns only the first item in the list (list index 0) to the variable df (By the way, the initial comma in the ListDataFrames parenthesis is a stray, and should not be there) question 2: layers = arcpy.mapping.ListLayers(mxd, "*", df) The double quoted star is a wildcard, just like "Layers" in the command before, only this time you want to assign the entire list (as a list) of layers in data frame df in document mxd to the variable layers You need this list of layer objects to iterate through all the layers in that data frame for layer in layers: you check each layer's name against your list and the ones on the naughty list get turned off. As you finish, you make sure the display reflects the changes you made.
... View more
06-26-2014
03:36 AM
|
0
|
0
|
604
|
POST
|
If you split the lines using SplitLine (or the toolbox tool Split Line At Vertices) The new lines will still have any original line ID you may have used and be in order in the table from original from onwards. You can identify the individual parts in order and add a segment ID. For example, add an integer segID field to your table and you already have your origLineID field: Use an update cursor to run through the table and for each new origLineID, you start with a segID of 1, and each time the origLineID stays the same, you increment the segID. With line and segment ids, you can create a dictionary of a list of incidence angles, in segment order, for each original line Then it is always differences between adjacent pairs of angles. This is all just off the cuff: no warranties...
... View more
06-25-2014
11:21 AM
|
0
|
0
|
240
|
POST
|
The Copy tool is the primary method. Try reading: Help > Geodata > Geodatabases > Copying geodatabases
... View more
06-23-2014
06:51 AM
|
0
|
0
|
1225
|
POST
|
You managed to 'simplify' your problem into something quite different from your second explanation. That second explanation may be a bit oversimplified too. Your pseudo code does not make your workflow much clearer. This forum is not really a good place to gloss over 'details'. for example: Why are you unioning the subfiles of Shapefile1? Where does Shapefile2 come in? is outfeatures always "X.shp"? I assume you realize that there is a difference between outfeatures and outFeatures ? why does a for loop start up between two union operations? No one can guess any of this. Post your real code, and put it between code tags (the '#' button on the editor toolbar). Be all that as it may... If you have concerns about geometry issues, I suggest converting the shape files to file geodatabase feature classes and then running check or repair geometry. Shapefiles can be depressingly tolerant of internal faults. I assume your output is important, I asked if there was any output from the first stage(s) (that is, in the "two intersects" you were trying to union, as per your first post).
... View more
06-23-2014
04:23 AM
|
0
|
0
|
659
|
POST
|
A couple things: You test the count of features in the input fc using GetCount_management, why not test the output too?. You can test both the layer and the new fc. Why do you make a layer, make a selection, make a fc? Why not just make a layer with your selection where clause and pass the layer to CostPath? The Help for Cost Path says it takes an input feature layer, not a feature class. I agree that you should also explicitly handle your layers and FCs with full paths and an explicit " if Exists: Delete " function... EDIT: very good point from Dallas (below); to wit: iterate through the cursor, don't rely on a separate counter, and feature IDs are internally set: they can be useful, but Arc puts them there for its own benefit, not yours...
... View more
06-23-2014
03:54 AM
|
0
|
0
|
537
|
POST
|
arcpy.DisconnectUser() disconnects other users, not the current administrative user. It would, I suppose, be possible to use an administrative connection to disconnect non-administrative connection, but that only works (if it does at all in this scenario) if the user is an administrative user It would be good to have a way to disconnect oneself from an SDE database: one can do it interactively in ArcCatalog....
... View more
06-20-2014
11:18 AM
|
0
|
0
|
438
|
POST
|
One assumes you divided the large shapefile into two non-overlapping geographic areas. thus, a Merge or Append may be a better option for joining the intersect outputs. Are there features in each intersect output?
... View more
06-20-2014
05:57 AM
|
0
|
0
|
659
|
POST
|
Using xml to copy large and complex data sets is not recommended by Esri. The Help entry "Copying a geodatabase using geodatabase XML workspaces" notes: <quote> The resulting geodatabase XML document can be huge when you copy both the data as well as the schema. Generally, this alternative is not recommended for copying geodatabase data. Alternatives for making a geodatabase copy include the use of the Copy tool and the Extract Data Wizard in ArcMap to copy subsets of the information. <unquote> Exporting to xml depends on how well the workspace contents render into xml by Arc, which is expecting arc-type objects. Things it cannot handle (BLOBS like attachments) get stored as XMLPersistedObjects, which are, I imagine, a bit unwieldy.
... View more
06-20-2014
03:59 AM
|
0
|
0
|
1225
|
Title | Kudos | Posted |
---|---|---|
1 | 01-16-2014 08:15 AM | |
1 | 01-08-2014 02:38 AM | |
1 | 05-30-2014 10:56 AM | |
1 | 06-07-2013 04:43 AM |
Online Status |
Offline
|
Date Last Visited |
11-07-2023
12:08 AM
|