POST
|
Hello, I am trying to automate a long process in model builder and I am having trouble with one of the steps. I have the ArcGIS 10.2.2 student software and I am trying to run the following model: I know there is a lot there, but the part I am having trouble with involves selecting by attributes from a feature, making a layer, and then copying the features so I then do some more geoprocessing (dissolve, etc.). The model works great until I get to the "Copy Features" tool which spits out the following error: Failed to execute. Parameters are not valid. ERROR 000840: The value is not a Feature Layer. ERROR 000840: The value is not a Raster Catalog Layer. Failed to execute (Copy Features). Just for kicks, I tried the "Create Feature Class" and "Feature Class to Feature Class" tools and I get the same error message. I am really baffled here because I broke up this model into smaller components and ran the following model that starts after the "Script" tool in my other picture and the "Copy Features" tool works just fine: I need the first model to work, however, because I need to use an early output in a geoprocessing step later (I just haven't incorporated that step into the model yet). Any help would be greatly appreciated. Let me know if I should post any other helpful information. Thanks, Pat
... View more
02-22-2017
04:46 PM
|
0
|
2
|
2685
|
POST
|
That's a good idea - I probably shouldn't have told the script to print a message if it didn't work. After taking out that part of the code, I found and fixed an error, but I have a new error now that I am trying to loop through multiple storms. I made point feature classes for Katrina and Rita (just as examples) in a gdb and am trying to loop through them to create buffers but I can't because I get an error that the output featureclass already exists: arcpy.env.workspace = "C:\Users\Patrick\OneDrive\Dissertation\Cyclone GDP\Analysis\GIS\Katrina_ModelBuilder\Katrina_Test.gdb"
...
... # List the feature classes in gdb
... fc = arcpy.ListFeatureClasses()
...
... # Loop through feature classes to create buffers:
... for fc in fc:
... sr = arcpy.Describe(fc).spatialReference # points spatial reference
... Storm_buffs = [] # placeholder for wedges
... max = 200 # distance larger than the maximum wedge
... with arcpy.da.SearchCursor(fc,['SHAPE@','NE_34','SE_34','SW_34','NW_34','NE_50','SE_50','SW_50','NW_50','NE_64','SE_64','SW_64','NW_64'], spatial_reference=sr) as cursor: # loop through points
... for row in cursor:
... cur = row[0].centroid # convert point geometry to point object
... up = arcpy.Point(cur.X,cur.Y+max) # make points from which to make boxes later
... upright = arcpy.Point(cur.X+max,cur.Y+max)
... right = arcpy.Point(cur.X+max,cur.Y)
... downright = arcpy.Point(cur.X+max,cur.Y-max)
... down = arcpy.Point(cur.X,cur.Y-max)
... downleft = arcpy.Point(cur.X-max,cur.Y-max)
... left = arcpy.Point(cur.X-max,cur.Y)
... upleft = arcpy.Point(cur.X-max,cur.Y+max)
... boxes = {'NE':arcpy.Polygon(arcpy.Array([[cur,up,upright,right]]),sr),
... 'SE':arcpy.Polygon(arcpy.Array([[cur,right,downright,down]]),sr),
... 'SW':arcpy.Polygon(arcpy.Array([[cur,down,downleft,left]]),sr),
... 'NW':arcpy.Polygon(arcpy.Array([[cur,left,upleft,up]]),sr)} # make boxes
... for field in cursor.fields[1:]: # loop through the fields following the point geometry field
... cur_buff = row[0].buffer(row[cursor.fields.index(field)]) # make a buffer
... clip_buff = boxes[field[:2]].intersect(cur_buff,4) # clip the buffer by the corresponding box
... len(Storm_buffs)
... Storm_buffs.append(clip_buff) # record the wedge
... arcpy.CopyFeatures_management(Storm_buffs,"C:\Users\Patrick\OneDrive\Dissertation\Cyclone GDP\Analysis\GIS\Katrina_ModelBuilder\Katrina_Test.gdb\Storm") # write the wedges
...
Runtime error Traceback (most recent call last): File "<string>", line 31, in <module> File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\management.py", line 2429, in CopyFeatures raise e ExecuteError: ERROR 000725: Output Feature Class: Dataset C:\Users\Patrick\OneDrive\Dissertation\Cyclone GDP\Analysis\GIS\Katrina_ModelBuilder\Katrina_Test.gdb\Storm already exists. This error makes sense because in line 31 I just save the buffers with a name that wouldn't changed after the script goes to the next storm. Do you know if it is possible to indicate the name of an output be the same or a variant of the input? Thanks again for your time, Pat
... View more
02-06-2017
06:22 PM
|
0
|
0
|
529
|
POST
|
Hi Darren, Me again. Thanks again for all your help. I'm trying to modify the great code you wrote in order to be able to loop through multiple storm point feature classes and create buffers. I'm not great with python but I gave it a shot but couldn't get it to work. Would you mind taking a look at it to let me know if I'm on the right track (or, more appropriately, where I'm going wrong)? try:
... arcpy.env.workspace = "C:\Users\Patrick\OneDrive\Dissertation\Cyclone GDP\Analysis\GIS\Katrina_ModelBuilder\Katrina_Test.gdb"
...
... # List the feature classes in gdb
... fc = arcpy.ListFeatureClasses()
...
... # Loop through feature classes to create buffers:
... for featureClass in fc:
... sr = arcpy.Describe(fc).spatialReference # points spatial reference
... Storm_buffs = [] # placeholder for wedges
... max = 200 # distance larger than the maximum wedge
... with arcpy.da.SearchCursor(fc,['SHAPE@','NE_34','SE_34','SW_34','NW_34','NE_50','SE_50','SW_50','NW_50','NE_64','SE_64','SW_64','NW_64'], spatial_reference=sr) as cursor: # loop through points
... for row in cursor:
... cur = row[0].centroid # convert point geometry to point object
... up = arcpy.Point(cur.X,cur.Y+max) # make points from which to make boxes later
... upright = arcpy.Point(cur.X+max,cur.Y+max)
... right = arcpy.Point(cur.X+max,cur.Y)
... downright = arcpy.Point(cur.X+max,cur.Y-max)
... down = arcpy.Point(cur.X,cur.Y-max)
... downleft = arcpy.Point(cur.X-max,cur.Y-max)
... left = arcpy.Point(cur.X-max,cur.Y)
... upleft = arcpy.Point(cur.X-max,cur.Y+max)
... boxes = {'NE':arcpy.Polygon(arcpy.Array([[cur,up,upright,right]]),sr),
... 'SE':arcpy.Polygon(arcpy.Array([[cur,right,downright,down]]),sr),
... 'SW':arcpy.Polygon(arcpy.Array([[cur,down,downleft,left]]),sr),
... 'NW':arcpy.Polygon(arcpy.Array([[cur,left,upleft,up]]),sr)} # make boxes
... for field in cursor.fields[1:]: # loop through the fields following the point geometry field
... cur_buff = row[0].buffer(row[cursor.fields.index(field)]) # make a buffer
... clip_buff = boxes[field[:2]].intersect(cur_buff,4) # clip the buffer by the corresponding box
... len(Storm_buffs)
... Storm_buffs.append(clip_buff) # record the wedge
... arcpy.CopyFeatures_management(Storm_buffs,"C:\Users\Patrick\OneDrive\Dissertation\Cyclone GDP\Analysis\GIS\Katrina_ModelBuilder\Katrina_Test.gdb\Storm") # write the wedges
... except:
... print "Script failed to complete"
... print arcpy.GetMessages(2) I know I'm not doing line 32 right because I want the output to have the same name as the input , or a variant of, but I'm just testing this out on one feature class right now and it won't work. As always, I would appreciate any suggestions. Thanks again, Pat
... View more
02-06-2017
03:37 PM
|
0
|
2
|
529
|
POST
|
Hi Darren, My dataset consists of storms that pass through UTM zones 14-18 so I thought it might be a good idea to project to WGS 1984 World Mercator to make sure I'm not going out of bounds anywhere. I am using just one storm (Katrina) to test the code on, so my attribute table looks like: I made sure to change my values from nautical miles to meters per your suggestion. I ran the following code and got the same error: fc = "Katrina_WGS" # points feature class
... sr = arcpy.Describe(fc).spatialReference # points spatial reference
... out_buffs = [] # placeholder for wedges
... max = 1000000 # distance larger than the maximum wedge
... with arcpy.da.SearchCursor(fc,['SHAPE@','NE_50','SE_50','SW_50','NW_50','NE_64','SE_64','SW_64','NW_64'], spatial_reference=sr) as cursor: # loop through points
... for row in cursor:
... cur = row[0].centroid # convert point geometry to point object
... up = arcpy.Point(cur.X,cur.Y+max) # make points from which to make boxes later
... upright = arcpy.Point(cur.X+max,cur.Y+max)
... right = arcpy.Point(cur.X+max,cur.Y)
... downright = arcpy.Point(cur.X+max,cur.Y-max)
... down = arcpy.Point(cur.X,cur.Y-max)
... downleft = arcpy.Point(cur.X-max,cur.Y-max)
... left = arcpy.Point(cur.X-max,cur.Y)
... upleft = arcpy.Point(cur.X-max,cur.Y+max)
... boxes = {'NE':arcpy.Polygon(arcpy.Array([[cur,up,upright,right]]),sr),
... 'SE':arcpy.Polygon(arcpy.Array([[cur,right,downright,down]]),sr),
... 'SW':arcpy.Polygon(arcpy.Array([[cur,down,downleft,left]]),sr),
... 'NW':arcpy.Polygon(arcpy.Array([[cur,left,upleft,up]]),sr)} # make boxes
... for field in cursor.fields[1:]: # loop through the fields following the point geometry field
... cur_buff = row[0].buffer(row[cursor.fields.index(field)]) # make a buffer
... clip_buff = boxes[field[:2]].intersect(cur_buff,4) # clip the buffer by the corresponding box
... len(out_buffs)
... out_buffs.append(clip_buff) # record the wedge
... arcpy.CopyFeatures_management(out_buffs,r'in_memory\out_buffs') # write the wedges
...
Runtime error
Traceback (most recent call last):
File "<string>", line 22, in <module>
File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\arcobjects\arcobjects.py", line 809, in intersect
return convertArcObjectToPythonObject(self._arc_object.Intersect(*gp_fixargs((other, dimension))))
ValueError: <geoprocessing describe geometry object object at 0x2929FAA0> Thanks again for your help, Pat
... View more
01-18-2017
06:43 PM
|
0
|
0
|
529
|
POST
|
Thanks for the suggestions Dan. I projected my points to meters, reran the code, and got the same error. I pasted the code under Rebecca Strauch's comment. I would appreciate any feedback. Thanks, Pat
... View more
01-18-2017
01:37 PM
|
0
|
0
|
529
|
POST
|
Thanks for the suggestion Rebecca. Per Dan Patterson's suggestion, I projected my points to meters, reran the code, and got the same error at the end: >>> fc = "Katrina_Project" # points feature class
... sr = arcpy.Describe(fc).spatialReference # points spatial reference
... out_buffs = [] # placeholder for wedges
... max = 1000000 # distance larger than the maximum wedge
... with arcpy.da.SearchCursor(fc,['SHAPE@','NE_50','SE_50','SW_50','NW_50','NE_64','SE_64','SW_64','NW_64'], spatial_reference=sr) as cursor: # loop through points
... for row in cursor:
... cur = row[0].centroid # convert point geometry to point object
... up = arcpy.Point(cur.X,cur.Y+max) # make points from which to make boxes later
... upright = arcpy.Point(cur.X+max,cur.Y+max)
... right = arcpy.Point(cur.X+max,cur.Y)
... downright = arcpy.Point(cur.X+max,cur.Y-max)
... down = arcpy.Point(cur.X,cur.Y-max)
... downleft = arcpy.Point(cur.X-max,cur.Y-max)
... left = arcpy.Point(cur.X-max,cur.Y)
... upleft = arcpy.Point(cur.X-max,cur.Y+max)
... boxes = {'NE':arcpy.Polygon(arcpy.Array([[cur,up,upright,right]]),sr),
... 'SE':arcpy.Polygon(arcpy.Array([[cur,right,downright,down]]),sr),
... 'SW':arcpy.Polygon(arcpy.Array([[cur,down,downleft,left]]),sr),
... 'NW':arcpy.Polygon(arcpy.Array([[cur,left,upleft,up]]),sr)} # make boxes
... for field in cursor.fields[1:]: # loop through the fields following the point geometry field
... cur_buff = row[0].buffer(row[cursor.fields.index(field)]) # make a buffer
... clip_buff = boxes[field[:2]].intersect(cur_buff,4) # clip the buffer by the corresponding box
... out_buffs.append(clip_buff) # record the wedge
... arcpy.CopyFeatures_management(out_buffs,r'in_memory\out_buffs') # write the wedges
...
Runtime error
Traceback (most recent call last):
File "<string>", line 22, in <module>
File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\arcobjects\arcobjects.py", line 809, in intersect
return convertArcObjectToPythonObject(self._arc_object.Intersect(*gp_fixargs((other, dimension))))
ValueError: <geoprocessing describe geometry object object at 0x2A2F8380> Any suggestions would be greatly appreciated. Also, is the geonet email working again? Thanks, Pat
... View more
01-18-2017
01:26 PM
|
0
|
5
|
529
|
POST
|
Hello Darren, Thanks again for your thorough help. I have been trying to execute the great code that you suggested on one particular storm that I created a feature class for and I keep getting this error: >>> fc = "Katrina2005_Points" # points feature class ... sr = arcpy.Describe(fc).spatialReference # points spatial reference ... out_buffs = [] # placeholder for wedges ... max = 100000 # distance larger than the maximum wedge ... with arcpy.da.SearchCursor(fc,['SHAPE@','NE_64','SE_64','SW_64','NW_64','NE_50','SE_50','SW_50','NW_50'], spatial_reference=sr) as cursor: # loop through points ... for row in cursor: ... cur = row[0].centroid # convert point geometry to point object ... up = arcpy.Point(cur.X,cur.Y+max) # make points from which to make boxes later ... upright = arcpy.Point(cur.X+max,cur.Y+max) ... right = arcpy.Point(cur.X+max,cur.Y) ... downright = arcpy.Point(cur.X+max,cur.Y-max) ... down = arcpy.Point(cur.X,cur.Y-max) ... downleft = arcpy.Point(cur.X-max,cur.Y-max) ... left = arcpy.Point(cur.X-max,cur.Y) ... upleft = arcpy.Point(cur.X-max,cur.Y+max) ... boxes = {'NE':arcpy.Polygon(arcpy.Array([[cur,up,upright,right]]),sr), ... 'SE':arcpy.Polygon(arcpy.Array([[cur,right,downright,down]]),sr), ... 'SW':arcpy.Polygon(arcpy.Array([[cur,down,downleft,left]]),sr), ... 'NW':arcpy.Polygon(arcpy.Array([[cur,left,upleft,up]]),sr)} # make boxes ... for field in cursor.fields[1:]: # loop through the fields following the point geometry field ... cur_buff = row[0].buffer(row[cursor.fields.index(field)]) # make a buffer ... clip_buff = boxes[field[:2]].intersect(cur_buff,4) # clip the buffer by the corresponding box ... out_buffs.append(clip_buff) # record the wedge ... arcpy.CopyFeatures_management(out_buffs,r'in_memory\out_buffs') # write the wedges Runtime error Traceback (most recent call last): File "<string>", line 22, in <module> File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\arcobjects\arcobjects.py", line 809, in intersect return convertArcObjectToPythonObject(self._arc_object.Intersect(*gp_fixargs((other, dimension)))) ValueError: <geoprocessing describe geometry object object at 0x26F916C0> I can't quite make heads or tails of it. If you have any suggestions, I would really appreciate it. Also, and this might be my unfamiliarity with python showing, but my data for wind speed quadrant (NE_50, SE_50, etc.) is in nautical miles - is that what this program assumes? Thanks again for your time, Pat
... View more
01-16-2017
07:13 PM
|
0
|
9
|
962
|
POST
|
WOW thanks for the thorough reply, Darren! That looks almost exactly what I'm trying to do. I certainly have a lot to digest here. Hopefully I'll be able to test it out later on in the week. I assume it wouldn't be too hard to go from what you created to create polygon features based on wind radii (so the 64 kt wedges are one polygon around each point) that can be used to identify which wind bands go over which cities. That may take some tinkering but I think I can figure that out. Thanks
... View more
12-19-2016
07:41 PM
|
0
|
0
|
962
|
POST
|
Thanks for the response, Abdullah. I have a lot of points - almost 5,000 in total. I have a school site license so I do not think it's an advanced license. Hopefully something can still be done with that information. Thanks
... View more
12-19-2016
03:29 PM
|
0
|
0
|
962
|
POST
|
Sorry, I just realized I didn't actually reply to you, I replied to the post. Please refer to the picture in the post below. Thanks for your help.
... View more
12-19-2016
08:42 AM
|
0
|
0
|
962
|
POST
|
Sure thing. I found this picture online that shows almost exactly what I want to do: Ignoring the different colors which would be like different layers based on wind speed, I'm wondering if it's possible to create buffers around a point that have different radii per quadrant. The radius length for each quadrant (NE, SE, SW, and NW) would be indicated in an attribute table.
... View more
12-17-2016
07:12 PM
|
1
|
0
|
962
|
POST
|
Hello, I couldn't find an answer to this in previous discussions so hopefully I'm asking a new question. I am using ArcMap 10.2.2 and I have "extended best track" data for tropical cyclones which has latitude and longitude locations of storms at 6 hour intervals as well as estimated wind radii for the NE, SE, SW, and NW quadrants at those locations. For instance, at lat x long y, this data might have estimated radius for a 64 kt wind of 100 nautical miles in the NE quadrant, 75 nm to the SE, etc. So basically, I want to buffer these point locations with quadrant specific radii based on the attribute for that quadrant. Is this possible to do? I'm not well versed in coding but I would be willing to try to figure it out if it is possible and can be automated either with python or model builder to do for multiple storms. Any suggestions would be much appreciated. Thanks, Pat
... View more
12-16-2016
04:24 PM
|
1
|
19
|
3146
|
Title | Kudos | Posted |
---|---|---|
1 | 12-17-2016 07:12 PM | |
1 | 12-16-2016 04:24 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|