|
POST
|
I ve got 2 polygon feature classes. I need transfer attribute from one to another based on location. One to one is not a problem. What I wanna do is transfer attribute(name) from all features which lies inside the feature to one field (name, name, ... ,name). If you have an ArcInfo license, you can do a Union operation. Otherwise you can use Join by Location -- which would be trickier but I think it's doable. Once you have all the rows in a table, you can combine them using this tool the geoprocessing team posted - pretty neat: Geoprocessing Blog: Concatenate Row Values
... View more
03-05-2012
07:45 PM
|
0
|
0
|
691
|
|
POST
|
Thanks very much...that is exactly what I had to do. Get Grid_Code value Find out if there is 4 of more cells with same land use grid code If there is and this value is greater than the center cell, then the center cell converts Linda, can you share your code here? I'm curious how you loaded the info into the dict and how you worked with it once it was there. Neat that you got pretty nice performance with a generic python dictionary. One thing to think about in this kind of analysis is whether the cell changes are "destructive", ie, when you move to the next cell to the right, and do the analysis again looking at the land use codes: does the analysis for the new location use the changed value, or the original? Good old Workstation grid neighborhood notation does not do that, it always looks back at the original raster.
... View more
03-05-2012
02:51 PM
|
0
|
0
|
1432
|
|
POST
|
One of the things that makes Arc 10 worth installing is model iterators, which avoid you all this drudgery.
... View more
03-05-2012
02:42 PM
|
0
|
0
|
4720
|
|
POST
|
Presumably you could use I/O redirection to do this -- but I think it would a lot easier to write the driver script in Python instead of the arguably primitive Windows command shell. (Not to knock it - the good old cmd.exe still has its place.) If your python scripts are set up to only work with command line arguments, you can run them with os.system() or (better) the newer" rel="nofollow" target="_blank">http://docs.python.org/library/subprocess.html#module-subprocess]newer subprocess module.
... View more
03-03-2012
06:12 AM
|
0
|
0
|
2282
|
|
POST
|
I think this may be a bug in the copy as python snippet. I contacted Esri Support and, sure enough: You are correct the Copy As Python Snippet for the Con tool is not generating the correct syntax. I have submitted a software bug report on your behalf for this issue. The reference number and subject line for this bug is as follows: [#NIM078805 The Spatial Analyst > Conditional > Con Python snippet from Results window uses incorrect syntax.]
... View more
03-03-2012
05:58 AM
|
0
|
0
|
2794
|
|
POST
|
I tried to import tkinter as a module in idle and it said no module exists. Does this come with the ArcGIS python install? Yes, it's part of the standard library along with math, string, etc. http://docs.python.org/release/2.6.7/library/tkinter.html >>> import Tkinter
>>> help(Tkinter)
Help on module Tkinter:
NAME
Tkinter - Wrapper functions for Tcl/Tk.
FILE
d:\python26\arcgis10.0\lib\lib-tk\tkinter.py
... View more
03-01-2012
02:03 PM
|
0
|
0
|
3487
|
|
POST
|
The error message makes me wonder if you've installed some 64 bit python or tried to install 64 bit Tkinter on top of 32-bit python. (You can only use 32-bit python with ArcGIS.) If you have installed Python, there is nothing special to download -- the Tkinter module is part of the standard Python library -- all you have to do is import it. (This is one of its main selling points.)
... View more
03-01-2012
12:59 PM
|
0
|
0
|
3487
|
|
POST
|
I wonder why the snippet code looks so different than the way Help describes how to write? The snippet example used the string representation of the argument (this is what is returned BTW by getParameterAsText()), the example in the help uses python structures like lists. Both argument formats are supported. In the tool and modelbuilder, the GUI usally handles all this text-object conversion for you -- when you're scripting you need to be very careful how you format arguments so the tool will see the correct object representation. The snippet code fails, btw: "AttributeError: 'module' object has no attribute 'Reclassify_sa'" I think this may be a bug in the copy as python snippet - as this syntax worked with 9.3 but won't work with 10.0. Most spatial analyst tools must be accessed using" rel="nofollow" target="_blank">http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00p600000002000000.htm]using Python map algebra in 10.0: arcpy.CheckOutExtension("spatial") outgrid = arcpy.sa.Reclassify(...) or arcpy.CheckOutExtension("spatial") from arcpy.sa import * ... outgrid = Reclassify(..,) I'm trying to convince my boss that python is a lot more efficient than clicking or modeling in ModelBuilder. It's a hard sell when i have to restart a script 8 times to get it to run. IMHO modelbuilder is a great macro tool for your work, but when you need to build a tool that needs full validation and documentation and error messages, python is the way to go.
... View more
03-01-2012
11:32 AM
|
0
|
0
|
2794
|
|
POST
|
My data is structured with counties as rows and individual species as columns with the presence/absence indicated by a 1 or 0. So in order to run the code for all species I am trying to select the values > 0 within the column of a species, export a jpeg with those counties selected, clear the selection, and then move to the next column (species) until it runs for all species. This means your integer column's names have spaces in them - this can get you in trouble, but if it's a file geodatabase it could work with an expression like: where = '\"%s\" > 0' % X I started with a simple polygon shapefile of counties and then merged the attribute table with a spreadsheet of all species of interest formatted like stated above. Would it be better to have the species as rows and counties as columns or in a single column with them comma-delimited per species? If so is there an easy way to do this? This is actually a better data design because the table doesn't have to be so wide, and you can use a nice, safe column names like SPECIES and COUNTY. The Excel copy / paste special / transposed may get you most of the way there formatting your data, though you may have to dive into pivot tables. In that case, you can create a table view of a your county-species table, and select for those in your species: tv = arcpy.MakeTableView(SpecCounty,"tv")
arcpy.SelectLayerByAttribute(tv,"","SPECIES = \'%s\'" % X)
# KEEP_COMMON will unselect non-matching rows
arcpy.AddJoin("County_poly","COUNTY",tv,"COUNTY","KEEP_COMMON")
#
# .. make your plot here ..
#
# Now remove the join (this clears the selection for the next loop)
joinName = gp.Describe("County_poly").Name
arcpy.RemoveJoin("County_poly",joinName)
... View more
03-01-2012
10:14 AM
|
0
|
0
|
1742
|
|
POST
|
Your data structure is really unclear to me. Do you have a field in you county table that lists occurring species, comma-delimited, or something like that? If that's the case your query expression could be formed like this:
# where "SpecField" LIKE '%Achillea millefolium%')
where = '\"%s\" LIKE \'%%%s%%\' % (SpecField,X)
... View more
03-01-2012
09:15 AM
|
0
|
0
|
1742
|
|
POST
|
I need help really urgently. There is a tool in 9.3 that does this: Raster To Other Format (Multiple) in the Conversion toolbox.
... View more
02-24-2012
07:48 PM
|
0
|
0
|
1266
|
|
POST
|
The old-style results window came up! �?? you know the one that shows a progress bar and gives reports in courier text. And when failing to execute, the dialogue box came back with my inputs. If you want to see it all the time, turn off background geoprocessing. That's the first thing I do when I install Arc 10! "Table name is invalid" may have to do with how you are naming your output rasters. If they are grids, you need to be very careful to name them with less than 13 characters. My mantra: always start with a letter, and eschew any non-alpha character (except "_") in ArcGIS names and your life will be better.
... View more
02-24-2012
06:10 PM
|
0
|
0
|
4150
|
|
POST
|
This is absolutely ridiculous, taking away the flexibility and usability of raster calculator combined with the old arcInfo functions was one of the worst design flaws of Arc10... Most of the Spatial Analyst tools are available in the new Raster Calculator. Mosaic and Mosaic To New Raster are not Spatial Analyst tools, so unfortunately they don't work in Raster Calculator. I also miss the old Merge local function ("grab the first non-Nodata value in the list of rasters, cell by cell) and would like to see either its return or a method to replicate it using the current functions in 10.0. It was a nice simple operator that did a simple thing -- tools like that are handy in map algebra when you're trying to solve a complex problem! (Now that I think about it, adding a FIRST and LAST statistics to Cell Statistics would be an easy way to implement Merge without adding another function. Good idea for ideas.esri.com!)
... View more
02-24-2012
05:39 PM
|
1
|
0
|
6715
|
|
POST
|
You may want to try some different renderers and see if they do any better. Issues like this are really good things to take to Esri support if you can -- because that's how NIM#'s (bugs) get logged -- and fixed. What is your ArcGIS Desktop version and service pack?
... View more
02-24-2012
04:53 PM
|
0
|
0
|
7907
|
|
POST
|
Attached is a picture of the results even though they all have the same value for class that I selected in land ownership. Tabulate Area can be very finicky, and is dependent on your inputs to get what you want. It looks like you've labeled your land ownership classes already differently in each HUC. If it's just one class and you want percent in each, an approach you may want to try is to reclass your land ownership to 100 (fed land, say) and 0 (not fed land) using the Reclassify_sa tool or a Con_sa. Then you can run Zonal Statistics As Table with your hucs as zones. The mean of the 0 and 100 cells in each zone will then be percent fed land, for example. We have published a tool that may help you if your problem is a little more complicated: Tabulate Areas To Percent in the NAWQA Area-Characterization Toolbox. There is a version with many bug fixes that works with both 9.3 and 10.0 on this ftp site. Hey, MVP status. Cool!
... View more
02-24-2012
04:30 PM
|
0
|
0
|
2647
|
| 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
|