|
POST
|
You need to loop through the features, creating a buffer for each one. As you access each one, you can multiply the value in the height field by your number. I doubt that you need or will see a better result by using a number with such precision, but hey, that's your call. You could use a search cursor to iterate through the records. If you have a relatively small number of unique heights, it might be faster to select sets of features by height and buffer all of them with that value at once.
... View more
04-09-2014
08:30 AM
|
0
|
0
|
5358
|
|
POST
|
I admit to not having heard of PYCAN before, but is this related to ArcGIS? I'm wondering if maybe you thought this was a general Python forum, but it's intended for python coding in ArcGIS, a GIS mapping software. My apologies if I'm wrong, just don't see anything GIS related in your code.
... View more
04-02-2014
11:42 AM
|
0
|
0
|
2078
|
|
POST
|
Yes, that appears to have fixed it. Dumb mistake on my part, but an even dumber error message. Thanks.
... View more
03-31-2014
06:10 AM
|
0
|
0
|
1061
|
|
POST
|
I wrote a hyperlink script in Python for the Display tab. It has an if/elif structure based on the value of a field. With just the if clause, it runs fine an opens the document. But when I add the elif clause, Arc gives me an error saying '...name OpenLink is not defined'. This makes no sense to me, it's the default name of the function. Any ideas? Thanks. import os, threading def OpenLink ([SubtypeCD], [Name] ): if [SubtypeCD] == 'Recorded' and [Name] is not None: parsedName = [Name].partition('-') folderPrefix = parsedName[0].zfill(4) fileSuffix = parsedName[2].zfill(4) extension = '.TIF' fileName = folderPrefix + fileSuffix + extension loc = r"\\base\path" image = os.path.join(loc, folderPrefix, fileName) threading.Thread(target=os.startfile, args=(image,)).start() elif [SubtypeCD] == 'Unrecorded' and [Name] is not None: parsedName =[Name].split('-') folderOne = parsedName[0] + '_Survey' folderTwo = [Name] fileName = [Name] + '0001.tif' loc = r"\\other\base\path' image = os.path.join(loc, folderOne, folderTwo, fileName) threading.Thread(target=os.startfile, args=(image,)).start() else: pass return
... View more
03-31-2014
05:26 AM
|
0
|
3
|
1689
|
|
POST
|
Ok, thanks Shaun. It's just to prevent user error since displaying map tips apparently interferes with the hyperlink tool. If the user remembers to keep them turned off, that'll work.
... View more
03-28-2014
12:12 PM
|
0
|
0
|
1047
|
|
POST
|
Is there a way to programatically turn off Map Tips (the ones on the Display tab) with Python? Thanks.
... View more
03-27-2014
12:26 PM
|
0
|
2
|
3345
|
|
POST
|
In your first example, you should pass CopyRaster dataset, rather than datasetList. Also not a good idea to use the word dataset as a variable name, since that has a specific meaning in ArcGIS and may be a reserved word in arcpy as well. You could just use d instead. Then, you're correct that you need to give an actual path & raster name. In your ListRasters call, "Raster" is an incorrect specification. In your case you want "TIF". I've also never seen a wildcard listed with a letter in List type functions, but don't know that it's incorrect. In any case, it would only get tifs starting with 'a'. Here's your first code corrected: import arcpy arcpy.env.workspace = "E:/Pyton/Prova/Tif" datasetList = arcpy.ListDatasets("*", "TIF") for d in datasetList: arcpy.CopyRaster_management(d,"e:/Pyton/prova/bil/new_rastername.bil") See here . As for your second example, I didn't go through it closely, but generally, it's not a good idea to end paths with a slash. Also, you don't want two slashes if you're using '/'. You'd only use two with '\' because '\' is an escape character, or if you were starting a UNC path.
... View more
03-27-2014
11:43 AM
|
0
|
0
|
1500
|
|
POST
|
You want to use ListRasters() and a for loop. An example from ESRI:
import arcpy
from arcpy import env
# Set the current workspace
env.workspace = "C:/Data/DEMS"
# Get a list of ESRI GRIDs from the workspace and print
rasterList = arcpy.ListRasters("*", "GRID")
for raster in rasterList:
print raster # replace this with your copy code The ()'s and *'s in your file names might be a problem, though. Also, a few thousand will take a long time, and might overwhelm your system. You might also want to look at the Raster to Other Format tool.
... View more
03-27-2014
06:56 AM
|
0
|
0
|
1500
|
|
POST
|
This may be a read only property that you can only set when creating the field.
... View more
03-19-2014
09:09 AM
|
0
|
0
|
2193
|
|
POST
|
In Python I use None to check for null values. Try something like:
if [field1].strip() != "" AND NOT [field1] Is None:
or maybe you could use:
if len([field1].strip()) > 0:
Not sure what your values are, so see what works best. This is also assuming field1 is a string, not a number.
... View more
03-19-2014
07:09 AM
|
0
|
0
|
4648
|
|
POST
|
You can also use a with statement when initializing the cursor to eliminate the need for del:
with arcpy.SearchCursor(in_feature, fields="NEAR_FID")as cursor1:
#loops here
... View more
03-19-2014
05:53 AM
|
0
|
0
|
1590
|
|
POST
|
Try this: import ctypes # An included library with Python install. ctypes.windll.user32.MessageBoxA(0, "Your text", "Your title", 1) Or define a function (Mbox) like so: import ctypes # An included library with Python install. def Mbox(title, text, style): ctypes.windll.user32.MessageBoxA(0, text, title, style) Mbox('Your title', 'Your text', 1) Note the styles are as follows: ## Styles: ## 0 : OK ## 1 : OK | Cancel ## 2 : Abort | Retry | Ignore ## 3 : Yes | No | Cancel ## 4 : Yes | No ## 5 : Retry | No ## 6 : Cancel | Try Again | Continue From Stack Overflow
... View more
03-18-2014
05:44 AM
|
0
|
0
|
1828
|
|
POST
|
The new feature should have the highest ObjectID, but I wouldn't necessarily rely on that. After creating it, before any edit session, while the new feature is still selected, put the ObjectID in a variable. Then when you go to edit, select that ObjectID.
... View more
03-14-2014
07:30 AM
|
0
|
0
|
1542
|
| Title | Kudos | Posted |
|---|---|---|
| 6 | 08-22-2019 07:41 AM | |
| 1 | 05-05-2014 04:30 AM | |
| 1 | 08-15-2018 06:23 AM | |
| 3 | 08-06-2018 07:31 AM | |
| 1 | 03-30-2012 08:38 AM |
| Online Status |
Offline
|
| Date Last Visited |
12-12-2021
01:00 PM
|