|
POST
|
Hi, I created a script tool in ArcGIS using Python. While the script tool is mostly functional, it does not complete the final step. This step is as follows in the Python code (Note: the syntax highlighter doesn't seem to work correctly but I think the syntax is right): try:
# Add Parameters
outrast = arcpy.GetParameterAsText(7) # Output raster dataset clipped to stream buffer polygons
# Run the clip tool on hillshade using the output buffer fc
arcpy.Clip_management(outpath, "#", outrast, buffout, "ClippingGeometry", 'NO_MAINTAIN_EXTENT')
# Add a success message
arcpy.AddMessage("Clipping of hillshade to buffer output successful!")
except:
# Report any error messages that the Buffer tool might have generated
arcpy.AddMessage(arcpy.GetMessage(0))
I have already defined buffout as arcpy.GetParameterAsText(5) and used it as an ouput parameter in arcpy.Buffer_analysis in a previous step in my code not shown above. In my script tool Properties, under the "Parameters" tab, I have set up buffout as a "Required" parameter with a direction of "Output". I'm assuming my problem is that I can't use an output parameter as an input parameter in a later step of code without adjusting the code somehow. How do I write code to use this output parameter as an input parameter in the arcpy.Clip_management() portion of my code above? I've struggled with this concept while designing script tools and it would be helpful to have a clear, exact method. If this is not the problem and my assumption is wrong, I'd appreciate any thoughts on another solution. Thanks!
... View more
03-17-2018
01:02 PM
|
0
|
7
|
4384
|
|
POST
|
Thank you Xander. It's an interesting problem. I appreciate your advice on it. While I wish there was a way to do things non-manually, I think unfortunately the data's precision requires the solution includes some manual work.
... View more
02-13-2018
12:33 PM
|
1
|
0
|
1209
|
|
POST
|
Ok, thank you for your help Dan. Agreed. I will stick with what gets me the most polygons and then do a manual overview. I will mark your intersect solution as correct.
... View more
02-13-2018
12:31 PM
|
0
|
0
|
1209
|
|
POST
|
Hi Xander. Unfortunately, the length of the lines, in theory, could be of all different lengths. As a general rule, they would be pretty short though, sort of like the small lengths of lines that pass through the polygons with the blue X in the first picture above. Using a minimum length somehow might be a good way to approach it though, since the dataset is relatively small I'm dealing with and miss polygons could be added manually.
... View more
02-12-2018
03:49 PM
|
0
|
4
|
6821
|
|
POST
|
Thanks for your help and creative idea Dan. I tried your suggestion but I did not get the results I wanted unfortunately. I think I oversimplified my features in the drawing. Essentially, there are cases in which dangles represent actual features (in other words, there are features that don't completely cross the polygons that I need to keep). Here are two examples of actual data I'm looking at: 1) I want to select and keep the polygons with a red X. Polygons with a blue X will be incorrectly selected using my current methodology, since the polyline and polygon precision is different: 2) Here's an example of a dangle I'd like to use to actually select an underlying polygon. I want to keep all polygons in this picture but to make it easier to distinguish, I put a Red X in the polygon with the dangle: Does that give you a better idea of what I'd like to accomplish? In any case, it's a fun problem! Thanks again, - Josh
... View more
02-12-2018
12:56 PM
|
0
|
6
|
6821
|
|
POST
|
Hi Chris and Dan. By drawing the two blue dots, I think I misled you both with my actual problem. My apologies. The two blue dots are not actual point features in ArcMap. They are just dots I drew in with Windows' Snipping Tool to distinguish the polygons that I'd like to be selected. Basically, I just want to end up selecting the two polygons marked by the blue dots, as these two polygons will represent a watershed around the stream feature (i.e. polyline feature). The third polygon that has no blue dot and has the dangle should not be selected. The dangle exists because my polyline and polygon data are not the same accuracy, which prevents me from nicely selecting the polygons that intersect the polylines. I would then export these polygons and dissolve them to have a final watershed around the stream of interest. Again, I'm sorry about the confusion and hopefully, that clears things up. Thank you!
... View more
02-12-2018
09:43 AM
|
0
|
10
|
6821
|
|
POST
|
Hello, I'm trying to select polygons from a feature class using a polyline feature class. See below for an example that shows the type of feature class/general concept I'm dealing with: I don't want to have all three polygons selected, just the two with the blue dots. My end goal is to export the selected polygons so that I can merge them into a one large polygon. It doesn't seem like there is a Select By Location method that can isolate the polygons I'm interested in (again, the two that contain dblue dots). I tried "Append" on the two feature classes (first had to convert polygons to lines) and then used "Trim Line". That worked to get rid of the dangle, but I couldn't get a line feature back that could be used for the purpose I wanted in Select By Location. Also, I tried Integrate to change the line to get it inside just the two Polygons of interest (so I could then use it to select the two polygons instead of having all three polygons selected), but that was a bit too messy for the actual feature classes I have. In other words, the line feature didn't modify in predictable way that would be helpful to use it in Select By Location. Thanks for your help, - Josh
... View more
02-11-2018
04:47 PM
|
0
|
13
|
10410
|
|
POST
|
Ok, thank you Rebecca. The answer that I have is very similar to Dan's response, so I marked his response as correct.
... View more
07-20-2017
08:46 AM
|
1
|
0
|
3724
|
|
POST
|
The surface constraint discussion starts around 30:00 in the video.
... View more
07-15-2017
09:51 AM
|
0
|
0
|
5731
|
|
POST
|
Thank you for your help and the included link Rebecca!!
... View more
07-13-2017
07:12 AM
|
0
|
0
|
3722
|
|
POST
|
Thank you for the explanation Josh (sorry I'm just getting around to it- I found a solution outside geonet). As a person who is relatively new in arcpy, I found the explanation you included extra helpful. Thanks!!
... View more
07-13-2017
07:11 AM
|
0
|
0
|
3722
|
|
POST
|
Sorry I'm just getting around to this. I was able to find a solution that is very similar to this answer. Thank you Dan!
... View more
07-13-2017
07:10 AM
|
0
|
2
|
3722
|
|
POST
|
Brief update: I have been able to isolate all boundary line differences between current and past year shapefile by converting polygons to lines (using Feature to Line tool). Then, I set up a geodatabase topology and had rule that said previous feature class lines must be covered by current year feature class boundary lines. Not sure if isolating the differences is helpful though, since I still need to figure out how to preserve lines that might be legitimate boundaries while getting rid of boundary lines that are just incorrect overlays or slivers... Any tips on how to proceed would be much appreciated!!
... View more
07-12-2017
01:56 PM
|
1
|
2
|
1849
|
|
POST
|
Hello, I have a bit of an interesting problem that I am trying to solve. Basically, I have multiple shapefiles of unprojected polygons that represent field boundaries over the course of about a decade. Each shapefile (there are ten in total) represents a single year of field boundaries. Over the course of the decade, there have been many changes to the field boundaries so there are legitimate shape differences between years that must be preserved. Here is the tricky part. I'd like to preserve these legitimate field boundary changes from different years that might represent a different field, while at the same time getting rid of field boundaries that are incorrect overlays/gaps, bad slivers, etc.. In other words, I need to keep any boundaries that are significantly different enough between years as legitimate field differences and get rid of any boundaries from different years that look like they should match up but they do not. In the end, I need to have a master polygon file of field boundaries over all years that respects the legitimate boundary differences between years and correct polygon geometery but eliminates slivers/gaps/bad overlays that are not correct between years. It is vital that the original attributes are preserved, too!! Note: I'm using the most recent year of field boundaries as the reference against which all other shapefiles field boundaries are compared. Depending on the year and location of the fields, there are very significant differences from the current year's field boundaries. My initial thought was that I need to eliminate potential non desired overlays, slivers, gaps, etc. I've tried the Integrate tool, but I've found it's nearly impossible to find an appropriate XY cluster tolerance that acceptably removes potential slivers/bad overlays between years while preserving a original features’ geometry (e.g. A polygon that represents a long skinny road in the shapefile might be collapse, for example). In addition, I've tried using Intersect and Merge tools but this does not seem to be an appropriate application for these tools. My conclusion is that I should create a geodatabase topology, but I am not sure that this is the right route to take either. I used the Feature to Line tool to create polylines and then set up a rule in my topology that the different feature classes must cover each other. This generates errors that quite nicely sum up the differences, but there are no automatic/quick fixes for this route (this particular rule does not have an associated topology error fix with it). Right now, I was thinking of exporting these errors as features in a feature class and then using a buffer on the current year field boundaries to delete the errors features that fall within that buffer distance. I'm pretty stuck at this point so any ideas to get the ball rolling would be very much appreciated! Thank you! - Josh Note: I need to make adjustments without changing the original shape of the field boundaries. Note: I need to automate this process as much as possible, so having arcpy ability with my geoprocessing tool is a must! Thanks!!
... View more
07-12-2017
12:08 PM
|
1
|
3
|
3172
|
|
POST
|
I have a 2D list: coordlist = [[0.0,0.0], [0.0, 1000.0], [1000.0, 0.0], [1000.0, 1000.0]] I'd like to figure out a way to add each element of coordlist (e.g. pairs of coordinates- [0.0,0.0]) into the arcpy.Point() class, but arcpy.Point() requires numbers as its inputs (e.g. arcpy.Point(0, 0). I don't think it can take anything else (e.g. a list in this case). So, something like arcpy.Point(0, 0) would work fine, but arcpy.Point(coordlist[0]) will give an error since it's a list. Any ideas on how to break down a list/tuple/array so that you can use it in arcpy.Point() to make point objects? I tried flattening coordlist and then using a loop, hoping to skip over every other x and y value in the flattened list, but could not figure that code out. I see this as potentially being pretty useful if you are trying to create a polygon from point objects and you have a large number of potential point objects in a list/array, not just 4 (since you can easily type up 4 point objects).
... View more
06-08-2017
03:22 PM
|
0
|
8
|
5133
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-23-2018 02:06 PM | |
| 1 | 05-04-2018 05:35 AM | |
| 1 | 08-10-2018 06:03 AM | |
| 1 | 02-13-2018 12:33 PM | |
| 1 | 07-20-2017 08:46 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:24 AM
|