|
POST
|
Let me give you some generic advice rather than just provide an answer. The conversion of tool input to Python syntax is sometimes quite complicated, and many tools are quite different, depending on the parameters. The easiest way to get a Python syntax to do what you want is to Run the tool interactively Go to the Geoprocessing > Results , right click the completed tool run, and pick "Copy Python Snippet" Paste in to your code and edit in your input variables into what was pasted. After that, hopefully the tool reference / help will have examples for most exceedingly complex operations (example: Calculate Field Examples in the help).
... View more
03-24-2013
03:17 PM
|
2
|
0
|
2774
|
|
POST
|
Greetings, My assignment is to create a custom tool on the tool bar using a python script. Do you need to create an add-in? Here's the help on that: Help 10.1: Creating an AddIn project http://resources.arcgis.com/en/help/main/10.1/index.html#//014p00000022000000
... View more
03-24-2013
03:11 PM
|
0
|
0
|
1388
|
|
POST
|
Hi, When I used Calculate Field tool in model builder, the experssion type (VB or Python) and the code block are not changed to align with the setting in "Field Calculator" window (click the little calculator icon). It will generate an error if the types are not the same. When using the tool manually, the expression type and code block will be automatically changed. Could someone help me about this? Thanks. What help do you need? It's impossible to totally convert a code block automatically anyway, the only thing that can be changed is the stub code. If you'd like it to try to do this, I recommend submitting to ideas.arcgis.com and see if the enhancement gets votes.
... View more
03-24-2013
03:08 PM
|
0
|
0
|
1177
|
|
POST
|
I've tried the merge, union and calculate values tool to somehow bring it all together, but no luck. I think Calculate Value is the tool you need to use. Make the output for your merge (right before you export to Excel, renamed "OutputTable" below) a precondition to Calculate Value - then have your calculate value tool look something like this: Expression: AddRadiusField(r"%OutputTable%","%RadiusColumns%") Code block:
import os
import arcpy
def RadiusTable(rc,tbl):
arcpy.AddField(tbl,"RADIUS","FLOAT")
rc = ";".split(rc)
Rows = arcpy.UpdateCursor(tbl)
k = 0
for Row in Rows:
Row.setValue("RADIUS",rc )
k += 1
del Row, Row
return tbl
Data Type: table Then connect its output to your export to Excel tool.
... View more
03-24-2013
03:03 PM
|
0
|
0
|
7778
|
|
POST
|
Does anyone have a method for detecting mound boundaries? You need a better definition of a mound. We got the local maximum nailed, but then you need to define the extent around the point. For example if you wanted to define the mound as all contiguous areas at or below the peaks we found using the above map algebra, within x amount of elevation, that would be a start.
... View more
03-21-2013
03:51 PM
|
0
|
0
|
2624
|
|
POST
|
I'm trying to build an exe using py2exe. See this thread Re: ArcGIS 10.1 python script to exe is not working (updated link) I suppose the main question is - why are you using py2exe? If someone has ArcGIS installed, they will have Python installed as well. If you are trying to hide your code you can b-code compile it (pyc).
... View more
03-21-2013
03:13 PM
|
0
|
0
|
3326
|
|
POST
|
for the time being I expect to have arcgis 9.3 only, though with arcinfo capability. In that case, try the Point Distance tool. The output will give you something you can easily manipulate to get what you want.
... View more
03-21-2013
03:07 PM
|
0
|
0
|
2247
|
|
POST
|
If python is what I need to learn I don't mind, it's the linking of a working python script (and validation/compilation of that script) to arcmap9.3 that concerns me. The command window in ArcGIS 9.3 is replaced with a real-live Python prompt ">>>" window in ArcGIS 10.0 In 10.0, the geoprocessor (gp) is still there and even deprecated tools and are still available if you crank up a geoprocessing object the 9.3 way (arcgisscripting.Create(9.3)). If you have a working Python script in 9.3, it will run without modification in 10.0. Updating 9.3 scripts to use 10.0 arcpy is not too difficult - except for spatial analyst, which involves learning "the new way to do it" with Python map algebra. my first task is to compare two point layers for example; find the 5 closest points in layer1 for each point in layer2 in ascending order (ie. ignoring the 6th closest point or farther); any good starting points or things to consider first? The easy way to do this (the Point Distance tool) requires ArcGIS Advanced (formerly ArcInfo). Join By Location if you are limited to ArcGIS Basic (formerly ArcView). Python scripts are linked to ArcGIS Desktop by way of creating a toolbox and adding scripts and models. Toolboxes, script tools, and ModelBuilder models (mostly) run unmodified in 10.0.
... View more
03-21-2013
11:27 AM
|
0
|
0
|
2247
|
|
POST
|
But I have 40+ feature classes and i want only three output error files ( point, line and polygon). how can I use copy features tool here, i believe it would overwrite the out file every time or would create many output files. You can use the append tool. I want to know what is causing error in my above script, I tested it and the execution stops exactly at the line where lnsertCursor comes. My guess is that since you created the feature class in a folder, it will have a shp extension. This probably would fix it (line 24): outErrPt = outFolder + os.sep + "AttributionError_Points" + ".shp" There's a neat tool in ArcInfo Worsktation that was designed for attribute testing, kind of miss that tool. The currently recommended workflow would be to set up and apply domains in the geodatabase, but that sure seems like a lot of trouble for all your fields.
... View more
03-21-2013
09:08 AM
|
0
|
0
|
1639
|
|
POST
|
I exactly used this , but still I have problem with this error: 'str' object has no attribute 'XMin' Sorry about that, here's an example of the code that does not work (it worked at 9.x):
def Origin(ext):
ext = ext.split()
return "%s %s" % (ext[0], ext[1])
Since extent is now handled as a full-fledged object, you can fix this code by either converting it to a string:
def Origin(ext):
ext = str(ext).split()
return "%s %s" % (ext[0], ext[1])
or requesting the extent object properties directly (probably the best way):
def Origin(ext):
return "%s %s" % (ext.XMin, ext.YMin)
... View more
03-21-2013
06:41 AM
|
0
|
0
|
5134
|
|
POST
|
I want to add to it but if I can't progress beyond this step, there's no point in using model builder. This does look like a bug. A single raster validates fine, but multi-value will not validate. I tried adding a dataset and THEN converting to multi value and that seemed to work, but then I had trouble when running the model as a tool. I got it to work fine with Iterate Files, which is more of a 10.x way to do it: [ATTACH=CONFIG]22797[/ATTACH]
... View more
03-20-2013
09:29 AM
|
0
|
0
|
1327
|
|
POST
|
I have classified (just with the "Reclassify") the image and have changed the colors. Now when I am trying to export this classification ("Data -> Export Data") I get the error message "Failed to save raster dataset". Is there some other possibilities to get the image with saved new colors? This does look like a file name issue. Depending on format there are rules (besides just simplicity) that you must follow. For example for Esri grid format, you must start with alpha, no non alphanumeric characters except "_", and must be <=13 characters in length. If it's not the name, try to export to a temp folder on the system where you are certain you have access. Exporting a raster will not necessarily save the colors (except for some formats like tiff that support colormaps). For that, you need to save the .lyr file.
... View more
03-20-2013
08:21 AM
|
0
|
0
|
2192
|
|
POST
|
In ArcCatalog 10.1 I can right-click a raster (say in a FGDB), select "Properties" from the menu to open the dialog that displays the basic information about that raster. Is there a way or a tool available that will save this information to a file? The Windows snipping tool will capture a screenshot. 😕 You would need to create your own script. Most raster properties are easily accessible via arcpy.Describe, and those that are difficult to access Describe are available using the Get Raster Properties tool. If you have a good use case about what such a report would look like, make your suggestion @ http://ideas.arcgis.com.
... View more
03-20-2013
08:13 AM
|
0
|
0
|
911
|
|
POST
|
I believe it would be a lot less complex to simply create a layer, build a query string off the data using a Search Cursor, and copy the records using the Copy Features tool.
... View more
03-20-2013
07:05 AM
|
0
|
0
|
1639
|
|
POST
|
Ok i added the permission to overwrite databases but now i get the attached error, for some reason i cant create a database connection, which i am assuming has something to do with the update. Any clue on how to fix it? It looks like you may not have write access to your geodatabase, or at least that part of it. To check this, connect to it manually in ArcCatalog and try to create a table there. Do you have to write your output to the ArcSDE database -- if all you want is a result you could write it to a local location.
... View more
03-20-2013
06:52 AM
|
0
|
0
|
2118
|
| 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
|