So What parameters to use for buffer-like custom tool?

2809
4
04-05-2016 11:58 AM
DaveWintermute
New Contributor

So I've been asked by a guy who does a lot of GIS work but who has very little programming experience to write a custom tool that's somewhat similar to the Buffer_analysis tool. He supplied me with a layer file that contains some buildings that I want to apply this custom buffering to.

I've been digging around trying to understand the difference between feature layers, feature classes, feature sets, and so on, and so far I've just found it to be hopelessly complicated. It seems as though what I really want to do is point my tool to the layer that I've imported, run it against the data contained therein, and have the output displayed as a second layer in the same active map. That seems like it should be fairly simple, as that's how the existing Buffer_analysis tool works.

What's the best way to accomplish this?

It seems as though I run into this problem where a layer potentially contains multiple feature classes, but some of these feature classes are apparently hidden by the current map. So I tried to instead pass a feature class as a parameter, but when I do that, the tool no longer lets me choose from the layers currently active in my project but rather requests that I supply a file path directly, but then when I try to navigate to the feature class that I guess is embedded in the layer file that was given to me, I can't actually find it anywhere (although I do see a bunch of output files that were created when I played around with the Buffer_analysis tool). I see that the Buffer_analysis tool actually takes a "Feature Set" as a parameter, so I tried to use that instead and it does let me select the layer I'm interested in that way, but then I can't figure out how to create a feature class out of this with all of the copied data that I want.

I was able to create and display a new layer from the existing layer, but apparently it's just referencing the same data, meaning that any modifications I do to this data just change the original layer data, which is a bad thing.

I started into this project with the expectation that it would be fairly simple to write a custom tool that behaved very similarly to the existing tool, but so far I've just gotten mired in a bunch of data layout details. Would appreciate any suggestions or clarifications that anybody has!

0 Kudos
4 Replies
DanPatterson_Retired
MVP Esteemed Contributor

what type of buffering are you trying to produce? for points, there are several options out there, like squares, triangles etc.  For polylines you can buffer on a line side, with square or rounded edges.  For polygons, there are examples of directional buffers where the shape and sie of the buffer increases in the 'downwind' side.  As for data inputs, a featureclass in a geodatabase or a shapefile would suffice.  In a pinch, use some other data or create some until you have the principles of your buffer down

0 Kudos
DaveWintermute
New Contributor

The buffering I want to do is specifically related to polygons, and in this case I want to buffer by a variable percentage (say, 50%) rather than by a fixed linear distance (like the Buffer_analysis tool would let me select "50m"). There is similar code available for QGIS here:

GitHub - jdugge/BufferByPercentage: Plugin for QGIS 2.0 for buffering polygon layers so the resultin...

So that's what I'm trying to accomplish. As for the data, is there a way to extract a feature class or a shapefile from this layer file I've got? I assume this should be an easy thing to do, but there are enough layers of indirection  that I've been unable to figure it out!

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

when you say layer file do you mean one with a *.lyr file extension?

In a pinch click on the whatever, select Data, Export data and either save it into a geodatabase or out to a shapefile.  It seems that the data has arranged for their convenience and I suspect not yours.

edit

you could troll around arcgis scripts beta Search ArcScripts (BETA)

here is an area buffer ( percentage too obviously)

http://www.arcgis.com/home/item.html?id=10b2645c4fcd4daf97100720d417424c

DaveWintermute
New Contributor

Thank you Dan, I believe this simple step may be all that I need to move forward!

0 Kudos