|
POST
|
As Darren said, if you are running your tool from ArcMap or ArcCatalog you do not need to explicitly set arcpy.env.workspace to a path. It will automatically be set to your default geodatabase as I mentioned earlier.
... View more
11-12-2015
09:09 AM
|
0
|
7
|
5207
|
|
POST
|
Are you talking about referencing your current workspace that is set in your environment settings in ArcMap? If so then arcpy.env.workspace would correctly reference your default geodatabase.
... View more
11-12-2015
08:17 AM
|
0
|
12
|
5207
|
|
POST
|
Kon, If you are still having this issue, maybe you would consider uploading one of your tins so that we can better understand what is happening here.
... View more
11-10-2015
04:09 AM
|
0
|
2
|
713
|
|
POST
|
Madan, If you have decided to go with Model Builder then you should use the Iterate Rasters function to have the tool step through the rasters in your workspace. Then string all the processing tools together as you have mentioned in your steps above. Then you could use the Collect Values function to collect all the output rasters from step 5 (subtract each cell of each raster to Value N). You can then use Cell Statistics with the 'SUM' stats type to sum up all the rasters. Let us know how you are doing!
... View more
11-09-2015
04:39 AM
|
0
|
0
|
1351
|
|
POST
|
Are you set on using python? You could also just use model builder to string together the tools which maybe an easier way to start. The you could export the model builder tool to python script and work from there.
... View more
11-06-2015
07:00 AM
|
1
|
0
|
1351
|
|
POST
|
The computed cellsize the tool picks is the same computation it does as if you were to pick OBSERVATION. It just does a division by 250. You can arbitrarily decrease the cellsize it picks for you because it will interpolate the cell values but you just have a better resolution raster for your viewshed. What you wouldn't want to do is increase the cellsize because then you will lose data in the raster interpolation.
... View more
11-06-2015
05:56 AM
|
2
|
3
|
2617
|
|
POST
|
This is a very helpful code thanks Dan and Toni. Not that it is needed Toni, but if all your raster are in a single workspace and you would like to compress your code you could have something like this: import arcpy,numpy
from arcpy import env
env.workspace = "C:\\RasterFolder"
rasters = [arcpy.RasterToNumPyArray(arcpy.Describe(ras).catalogPath,nodata_to_value=10000000000) for ras in arcpy.ListRasters()]
marray = numpy.ma.masked_values(rasters,10000000000)
per = 20
percentile_val = numpy.percentile(marray.compressed(),(per))
print percentile_val You could use a wild card to filter raster names and folders as well for the ListRasters function.
... View more
11-06-2015
05:34 AM
|
0
|
1
|
2585
|
|
POST
|
Yes you should change it to CELLSIZE 10 if you want 10 meter cells. Unless your spatial reference has a linear unit of feet then that will produce a cell size of 10 feet.
... View more
11-06-2015
04:16 AM
|
2
|
0
|
2617
|
|
POST
|
What spatial reference are you using? Did you set the sample distance to 'CELLSIZE 10' ?
... View more
11-06-2015
03:57 AM
|
0
|
9
|
2617
|
|
POST
|
Litan, is this problem in addition to the one you posted here: i am applying interpolation tool, that time i am defining the output cell size 75, here the processing is completed but… Are you getting a raster output, but not masked to your specified extent?
... View more
11-05-2015
06:50 AM
|
0
|
1
|
1070
|
|
POST
|
Typically this happens when your spatial reference is a geographic coordinate system the horizontal unit is an arc second or degree. If you set the output coordinate system in the environment settings to a projected coordinate system with a horizontal unit of meter it should work such as this:
... View more
11-05-2015
05:10 AM
|
1
|
0
|
1113
|
|
POST
|
If I'm understanding your question you are looking to get a total count of layers represented in the legend? If so then you could use: mxd = arcpy.mapping.MapDocument("Current")
df = mxd.activeDataFrame
legendCount = len(arcpy.mapping.ListLayoutElements(mxd, "LEGEND_ELEMENT", "Legend")[0].items)
... View more
11-03-2015
01:01 PM
|
0
|
1
|
810
|
|
POST
|
I'm not sure if you are looking to do this with python or not, but you might look into using various List functions and arcpy.da.walk().
... View more
11-03-2015
12:54 PM
|
0
|
1
|
1929
|
|
POST
|
Oh Okay I must have misunderstood what Siyang was trying to get at. Darren your code definitely works if he is searching for shapefiles of the same name throughout the workspace.
... View more
11-03-2015
10:00 AM
|
0
|
0
|
5301
|
|
POST
|
I definitely agree with Darren, but as Siyang has is set up right now he will produce a dictionary with keys for every feature class name found and the only item entry will be the same feature class path. This will essential attempt to merge a single feature class for each dictionary key. If Siyang's folder structure is set up with a workspace folder with multiple folders containing many shapefiles of the same type then he could modify his code like this: import arcpy, os
workspace = r'C:\Users\xxx\Desktop\boundary'
output_folder = r'C:\Users\xxx\Desktop\New folder'
Dict = {}
for root, dirs, files in os.walk(workspace,topdown=True):
for dir in dirs:
env.workspace = os.path.join(root,dir)
Dict[dir]=[]
for fc in arcpy.ListFeatureClasses():
if not fc in Dict[dir]:
Dict[dir].append(os.path.join(root,dir,fc))
else:
Dict[dir].append(os.path.join(root,dir,fc))
for key in Dict:
output = os.path.join(output_folder,key) + '_merge'
arcpy.Merge_management(Dict[key], output)
print output + " created" The code I previously posted would do the same thing, but it also allows for feature type filtering and also for a folder structure with a top level workspace with multiple folders each containing multiple subfolders with their own feature classes in them. Hope this helps!
... View more
11-03-2015
04:03 AM
|
0
|
3
|
5301
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-26-2016 10:40 AM | |
| 1 | 10-05-2015 09:10 AM | |
| 1 | 01-19-2016 06:01 AM | |
| 1 | 01-06-2016 05:27 AM | |
| 1 | 12-09-2015 05:59 AM |
| Online Status |
Offline
|
| Date Last Visited |
05-01-2024
04:58 PM
|