|
POST
|
I didn't think you could have any elements with the same name in a gdb.
... View more
08-11-2015
08:21 AM
|
0
|
4
|
3308
|
|
POST
|
If you use the 'with' construction, you don't have to worry about deleting cursors: with arcpy.da.UpdateCursor(fc,["Shape@XY","Latitude"]) as ucur:
x,row[1] = row[0]
ucur.updateRow(row)
... View more
08-04-2015
08:48 AM
|
3
|
3
|
2813
|
|
POST
|
To your first point, file size most likely comes from the OS you're running (Windows, Linux, etc.). You can get this from the os module in Python (e.g. see here). For your second point, there are probably several ways, but for your example an easy way would be to limit your search to just the possible extensions for files making up a shapefile. This would probably not work for a feature class in a file geodatabase, service, etc., as those are more complicated structures.
... View more
06-26-2015
09:33 AM
|
1
|
0
|
2137
|
|
POST
|
I don't know if all the quote marks on that line line up properly, but the final character should be ), not <.
... View more
06-24-2015
09:34 AM
|
0
|
0
|
1627
|
|
POST
|
I don't know of any function in arcpy, but this link might help, if I understand it correctly. It appears to be based on a feature layer extent, not a graphic as is available in the data frame version, but worth a shot. You could create a feature class/shapefile with the geometry you want and use that if needed.
... View more
06-02-2015
06:39 AM
|
1
|
2
|
1242
|
|
POST
|
Dan's way is no doubt better, but since I don't know numpy, what I meant is to read the values of each column into a list (arcpy.da.SearchCursor), then use set on that list. You can then turn the set back into a list if that is more appropriate for your needs. Repeat for each column. This will give you a a collection of sets (or lists) of unique values for each column. If you're in an environment where you can use SQL queries, you could also just issue a SELECT DISTINCT command. First link on googling 'python sql'.
... View more
05-22-2015
05:29 AM
|
1
|
1
|
6247
|
|
POST
|
You may want to look at sets in python. They essentially take a list of items and return a set of unique items in that list. E.g. >>> myList = [1, 3, 6, 1, 4, 7, 6)
>>> mySet = set(mylist)
>>> mySet
set([1, 3, 6, 4, 7])
>>> Maybe post some of your existing code and we can see what you need.
... View more
05-21-2015
12:56 PM
|
1
|
3
|
6247
|
|
POST
|
Wouldn't it be simpler just to return the first element of a split ProjectLD? Gets rid of your if statements. Or skip the function and just set codeblock3 to the first element. return ProjectLD.split()[0] or codeblock3 = ProjectLD.split()[0]
... View more
05-08-2015
06:27 AM
|
0
|
0
|
4551
|
|
POST
|
Couple things I see quickly... If you use Windows path separators, either use two instead of one or, my preference, precede the string with r fc = "C:\GIS_Data\Bathymetry\Global" change to... fc = r"C:\GIS_Data\Bathymetry\Global" or c = "C:\\GIS_Data\\Bathymetry\\Global" I don't see where you're getting [File_Name]. It should be set to a variable when you do get it. You need code to get this value. There's also no path separator between the directory and the file name in bathy_file = (fc+ [File_Name] +'.shp') instead, bathy_file = (fc+ '\\' + [File_Name] +'.shp') or import os bathy_file = os.path.join(fc, [File_Name]) + '.shp' Didn't really go through the rest of the code, but that's a start.
... View more
04-22-2015
11:53 AM
|
0
|
0
|
1299
|
|
POST
|
It's not explicitly stated, but possibly you can use the classBreakDescriptions property to enforce this. You might have to get the descriptions, read and modify them into a new list, then add that back. Never used this myself, so take the idea for what it's worth.
... View more
03-26-2015
10:59 AM
|
1
|
1
|
1712
|
|
POST
|
I believe you can set the classification method using ArcObjects, but that would be a question for a different forum. But if it's an issue, might be worth exploring.
... View more
03-25-2015
09:09 AM
|
1
|
0
|
2337
|
|
POST
|
You're setting input_layer to files. files is a list, not a shapefile or layer. Also, don't think 'if file = '*.shp' will work. The * isn't working as a wildcard in this case, so most likely you're never entering the if block. This is also indicated by the fact that no error is being thrown. That code is never run. You could try: if file.endswith('.shp) instead. Or import fname and use: if fname.fname('*.shp'). I'd also suggest putting in some print statements so you can see what values you're getting and where in the code you are. #For-loop for looping function over all files in a folder
for file in files:
if file.endswith('.shp'):
print('File name is: {0}'.format(file)
# Variables
output_layer = "C:\\Users\\Fred\\Desktop\\GIS\\ModelBuilder Project\\TEST\\test" + str(thectr)
arcpy.Buffer_analysis(file, output_layer, "1 Kilometers", "FULL", "ROUND", "ALL", "")
... View more
02-13-2015
06:52 AM
|
0
|
0
|
10570
|
|
POST
|
Yes, that's correct, my bad. ListLayers(mxd, "", df) would be more correct.
... View more
02-11-2015
05:13 AM
|
0
|
0
|
1728
|
| 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
|