Model Builder: how to convert a batch model to an interactive model

The principle of Model Builder is to create geoprocessing tools, which are by definition “batch” tools. This means that there is no   interaction between the user and the processing, once launched. You define the input data and you retrieve the output data.
In some occasions this aspect is binding. Imagine that you have to run a model in using only a portion of the data set and if you use the Clip tool you will be duplicating the data, or else you want to select an area on the map and apply your geoprocessing model only to entities completely contained in this area. There is another possibility, the one we are going to follow in this example, we will use a template with a specific tool that requires an entry point, such as “Field of View” and you want to enter manually the, or the, locations of the observer.

Well, it is possible to do this with Model Builder using an ENTITY DATASET.
You have never heard about it? Not surprising. It is really hidden!

The Game of entities will replace, in your model, an input layer of the model. By indicating at the very launch, that this Entity dataset is a parameter of the model, the execution window execution will open up and you will have the opportunity to seize manually, either in the table or on the map, the input elements of the model.

In the example we will discuss, you will click on the observation points that you want to process with the tool “Field of View”, then you click OK and the model will run on the entered points.

Setting up a classical model

We will build a classical model with Model Builder to calculate the “Field of View”. We need a DTM and a layer of points as input. We will get as output a raster with pixels 1, for visible pixels from one or various, observation points and pixels 0, for non-visible pixels.

The tool is located in the Spatial Analystr toolbox -> Size -> Field of View

 

 

We add the input raster:

 

What is not done by the classic model

Now we’re going to do something a little weird. We are going to add a layer a non descriptive type of point, and then we will apply on it a non descriptive symbology and will save it in a layer file. Once done, we remove the layer in ArcMap.

The only thing that matters is that the layer corresponds to the correct data type (point, line, polygon) for the tool we are using. Incidentally, the symbology is used at the time we enter the points, but everything else (coordinates, etc.) is not taken in account.

We perform this task and create a layer file “observateurs.lyr”

At what point the model is finished

For the time being, in our model, we do not always have an input points layer at the “Field of view” tool. We will add it now.

We will not do it as we would with a layer of points, by clicking and moving in the model. We will create a variable   :   click the right button regardless where in the template to open the context menu.
Select “Create a variable”

 

Search and select Entities dataset “(I have already told you that it was very good hidden!). There are a lot of lines Play … Be careful to choose the right one.

Connect the Entities Dataset  in the tool .

 

You will observe that the model is not ready to be executed. We, still, have to define the symbology of the Entities Dataset. We are going to assign the symbology to the layer file created above.

Right click on the Entities Dataset and select Properties. Open Data type and point to the layer file.

 

Now the model is ready to run. Do not worry about the undefined output, it’s an optional output of the tool that we will not use in this example.

 

Last step, define the model parameters. Right click on the blue ovals and select “Model Parameter”.

 

Register your model in a toolbox and close it.

Clarification: in order for the interactivity to work, the model should not be in edition mode. It becomes interactive when run with the Toolbox.

Finally, we run the model

 

Run the model with the toolbox.

The setting window opens: 

 

In this window you have a field of a new type. It corresponds to the data entry model, as in the window “Editor”. By clicking on the displayed model, the cursor becomes a input cursor. By clicking on the map of ArcMap you enter the points that will be taken in account by the model.

 

Once the input is ended, click OK to run the template. At the end of the process, you obtain the field map visual of the input points.

 

Do not hesitate to leave your questions!

Si cet article vous a intéressé et que vous pensez qu'il pourrait bénéficier à d'autres personnes, n'hésitez pas à le partager sur vos réseaux sociaux en utilisant les boutons ci-dessous. Votre partage est apprécié !

Leave a Reply

Your email address will not be published. Required fields are marked *