Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm using 10.2.2 arcgis

I have the following script

import arcpy
mxd = arcpy.mapping.MapDocument ("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
addLayer = arcpy.mapping.Layer(r"C:\Users\Document\Geomarketing\Datos\20140826\rest\PG_Restaurantes_GT.shp")
arcpy.mapping.AddLayer(df, addLayer, "BOTTOM")
del mxd, addLayer

The function of this script is to add a specific layer to my dataframe. I want to add this script into a model, my purpose is to have a checkbox to have the option to add or not to add the layer.

I am new to this and do not know what changes should I make to my script to let me do this in modelbuider.

Do I do this in my script?

share|improve this question

1 Answer 1

You will need to create a boolean variable and define it as a model parameter. This will add a check box option when double clicking on the model.

OR

Create a script tool that runs your code and has a boolean data type.

Either way you will have to check the boolean value using an if statement.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.