Thursday, 22 December 2016

arcgis desktop - Compound variables in Model Builder?


I'm trying to create a model wherein one of the parameters is a compound variable, that is made of multiple variables joined together. How can this be done?


For example: create an insider buffer using Buffer(analysis) and name the output feature class from the distance parameter.


Variables:


BufferDistance = 1000
InputFC = d:\test.gdb\boundaries

Buffer tool parameters:



Input Features = %InputFC%
Output Feature Class = %InputFC%_%BufferDistance%
Distance = -%BufferDistance% Meters

A negative buffer distance is needed to create an inside buffer, but that means the %BufferDistance% variable can't be used in the output FC name. Thus the need for a compound variable.



Answer



I've since learned it is also possible to do this using the Calculate Value tool, see Adding arbitrary code to ArcGIS ModelBuilder?. It's not as involved as creating a script and adding to a toolbox.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...