AnsweredAssumed Answered

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

Question asked by davew2040 on Apr 5, 2016
Latest reply on Apr 5, 2016 by davew2040

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!