|
POST
|
My 2 cents: Raster attribute tables are very tricky, as they are implemented differently for different image types. For example, with raw data formats like .bil, they are stored in an .aux/.aux.xml file. With .tiffs, the raster table is an RGB colormap table stored in the image header. ERDAS .img files look like more advanced tables, but I'm not sure you can successfully modify an .img's table because it is stored in the image itself. With grids, you may have better luck, as the table is a good old INFO table stored in the info folder parallel to the grid. In general, I've found it best practice to only use the VALUE and COUNT fields and handle any other table information by joining to a separate lookup table. This generally makes more sense because most raster tools drop all variables from the output except VALUE and COUNT. Your approach looks like it could be much more efficiently done (and perhaps with more success with non-grid formats, but I don't know...) by creating a lookup table in the in_memory workspace, populating it with a cursor, and then doing a Add Field / Add join / Calculate Field, or Join Field to copy the data over. But IMHO the separate ancillary data table is the most reliable path.
... View more
02-24-2012
04:20 PM
|
0
|
0
|
1596
|
|
POST
|
Because of edge effects, the tiles would need to overlap, and then the overlaps would need to be removed when joining the processed tiles back together. It could be automated, and perhaps someone else has already written a script to do that Should be noted that the Mosaic tool (and mosaic data sets on the fly) can handle the stitching back together with averaging overlapping areas. Splitting apart, well, we still need a script for that.
... View more
02-24-2012
04:10 PM
|
0
|
0
|
1806
|
|
POST
|
Here's some reusable code: import arcpy
import os
def ArcGISProfile(profilePath=None):
"""ArcGIS Windows user profile path"""
APPDATA = arcpy.GetSystemEnvironment("APPDATA")
if arcpy.GetInstallInfo("DESKTOP")['Version'].find("10") == -1:
path = os.path.join(APPDATA,"ESRI")
else:
path = os.path.join(APPDATA,"ESRI/Desktop10.0/")
return os.path.realpath(os.path.join(path,profilePath))
print ArcGISProfile("ArcToolbox\CustomTransformations") This returns (on XP): C:\Documents and Settings\cprice\Application Data\ESRI\Desktop10.0\ArcToolbox\CustomTransformations
... View more
02-23-2012
10:50 AM
|
0
|
0
|
1392
|
|
POST
|
There are a bunch of related NIM's on this, all having to do with the above .dll issue and metadata tools in the 10.0 Conversion toolbox. Hopefully this will be fixed in SP4. (Unfortunately I don't see any of these NIM's on the current 10.0 SP4 "issues to be addressed"...) NIM058011 NIM063624 NIM068626 NIM063624 NIM063623 NIM062944 NIM070175 Several of the NIM's mention a possible workaround if you can't do the GAC/.dll fix: try wrapping the tool inside a model and call that from Python.
... View more
02-23-2012
09:39 AM
|
0
|
0
|
937
|
|
POST
|
. The make feature layer is the very first tool in my model and, in theory, should erase the specified fields for the rest of the tool as the subsequent parts work off this feature layer. Make Feature Layer creates a view of the data in memory that marks some fields as not visible. They still are there though. You probably want to run the Delete Fields tool on an intermediate dataset to get rid of fields you do not want.
... View more
02-23-2012
09:33 AM
|
0
|
0
|
878
|
|
POST
|
Please kindly help and tell me how to rename and then save the new models (with tbx extension) I created in the �??ModelBuilder�?� Save tool (i.e. I want the new models (with tbx extension) renamed and then saved in the "red" Toolbox/trunk). Models don't have a tbx extension. Models must be saved inside a toolbox (.tbx) which serves as sort of a workspace for models and scripts. If you create a model from scratch with the model button in the desktop interface, you need to save them inside a toolbox. In the save dialog at the upper right there is (now, didn't used to be!) a button to create a toolbox in the current folder. Then you can navigate into that toolbox, name the model, and hit save.
... View more
02-22-2012
08:05 AM
|
0
|
0
|
698
|
|
POST
|
The arcpy example just posted by Jake S seems like it should address your original issue. but I think these extra quotes may cause trouble:
arcpy.MakeXYEventLayer_management('"' + fileTemp + '"', "X", "Y", outLayer)
instead:
arcpy.MakeXYEventLayer_management(fileTemp, "X", "Y", outLayer)
... View more
02-22-2012
07:39 AM
|
0
|
0
|
829
|
|
POST
|
math (sorry) is a module that is part of the standard library, ie it's in all python distributions. >>> import math
>>> help(math) If you're new to Python, be sure and check out: Brief" rel="nofollow" target="_blank">http://docs.python.org/tutorial/stdlib.html]Brief Tour of the Standard Library
... View more
02-22-2012
07:03 AM
|
0
|
0
|
2009
|
|
POST
|
There's a great programmer-oriented tutorial to get started with Tkinter in the Mark Lutz's Programming Python.The biggest advantage of Tkinter is that it's the most popular -- and is part of the standard library in every Python distribution -- no extra installs! [URL=http://matplotlib.sourceforge.net/]Matplotlib[/URL] is not part of the standard library, but is also very popular, easy way to display data. Esri is including matplotlib (and numpy, which I think was added for 9.3) in the standard ArcGIS 10.1 installation.
... View more
02-22-2012
06:28 AM
|
0
|
0
|
3486
|
|
POST
|
Looks like something you should report! If you get a NIM, please add it to this thread. I am wondering whether the issue may be data format related... is "raster" not a grid? The calculator may be doing a bad data translation on the direct read of the raster (a new capability in 10.0, in 9.3 it would convert to Esri Grid format (EGF) first). Kind of weird that the tools would work when map algebra doesn't -- the tools are the same now under the hood. Something to try is convert your raster to EGF (using Copy Raster) and try Raster Calculator with that.
... View more
02-22-2012
06:16 AM
|
0
|
0
|
2875
|
|
POST
|
Could someone point me in the right direction on how I would do this? You can read geometry and create features using cursors. It's a little tricky (and slow) but it can be done. Here's the help on that: Arc" rel="nofollow" target="_blank">http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002z0000001s000000]Arc 10 Help: Working with geometry in Python Be sure and avoid doing all the geometry yourself, there are some very handy functions in the standard library, especially math. Field Calculator supports a lot of calculations too - if you want store things in the attribute table: [post=169592]Common Python geometry calculations in the Field Calculator [/post]
... View more
02-22-2012
06:10 AM
|
0
|
0
|
2009
|
|
POST
|
I'm new to Python and what I want to do is very similar, only my list is of integer values (created by using range()). Using the above example, how would the query expression be changed if FIPSlist was integer instead of string (query field is also integer)? Just do it without the quotes. Also, to use the integer as part of the expression you need to convert the number to a string, using str() too:
FIPSlist = range(5) # (0,1,2,3,4)
for fip in FIPSlist:
query = "FIPS_PARIS = " + str(fip)
arcpy.TableSelect_analysis("Master_TAHI", FIPSpath + r"\FIPS" + str(fip) + ".dbf",query)
... View more
02-21-2012
02:32 PM
|
0
|
0
|
1991
|
|
POST
|
ArcMap 10.3 with spatial anlayst extension. Just to clarify, do you mean 10.0 SP 3?
... View more
02-20-2012
07:01 PM
|
0
|
0
|
2875
|
|
POST
|
Reposting: Hi Everyone, I have an interesting problem that I was hoping that I could get some ideas here on the forums. I want to apply a technique similar to that of the focal statistics majority method however, instead of assigning the value of the center cell that of the majority value I want to assign a predefined number. In other words, if in a 3x3 window, 5 cells that have a value of 4 assign the center cell a value of 1, 5 cells have a value of 8 assign the center cell a value of 1, however if there is no majority (i.e greater than 50%) assign a value of 0. I've heard that Focal Statistics or a moving window might be possible in Numpy? Any ideas on where to start? Thanks
... View more
02-19-2012
03:46 PM
|
0
|
1
|
1364
|
|
POST
|
Interestingly enough, a "zone" is processed in about 20 seconds at the outset, and then towards the end of the 800 features, it slows down to about 5 minutes to process one zone. My experience is that the gp/arcpy scratch name methods can be very slow when the workspace in which you are generating scratchnames gets full of many files. This can slow down all tools! You may get better performance if you just create an empty folder/workspace and generate names using sequence numbers. I have gotten in the habit with my general purpose script tools (like the [post=124423] NAWQA toolbox[/post]) of creating a temporary folder and workspace so I don't need to worry about file name collisions and can avoid waiting for the scratchname method!
... View more
02-17-2012
09:35 AM
|
0
|
0
|
2727
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-11-2021 01:26 PM | |
| 5 | 12-10-2021 04:58 PM | |
| 1 | 02-27-2017 09:30 AM | |
| 2 | 12-04-2023 01:05 PM | |
| 1 | 04-12-2016 10:17 AM |
| Online Status |
Offline
|
| Date Last Visited |
06-19-2024
12:10 AM
|