Note: Even though this article dates back to 2015, most of its content is, still, valid.
The different optimization methods addressed in previous articles can be achieved manually. But these are routine tasks, ie they have to be performed regularly.
One of GIS software main aims is to save time and avoid repeating your work . ArcGis has a module quite suitable for this task: the Model Builder.
Without any special programming knowledge, it allows you , by using a graphical interface , to create processing programs.
We will suppose, for the time being , that you know how to open Model Builder and store your models . We will return to the Model Builder basics in future articles. To see an introduction to Model Builder, you can visit the ESRI website : Tutorial – Creation tools with the Model Builder.
You also can take a look at YouTube presentation by Don Boyes ( in English ): Model Builder Introduction . Here is the model we are going to create, in order to automatize the compression addressed in the previous article, and the backup of an ArcGis geodatabase.
We will set up two tools : one to compact the geodatabase , the other to make a backup in another folder.
On the other hand, regarding the backup name, we need to retrieve the current date and add it to the name. This is the only difficulty . First step: Compacting the geodatabase.
– Open a new blank document in ArcMap
– Open a new model with Model Builder
” Click-Move tool
“Compact” in the toolbox “Data Management” ->
Tip : Do not load the
geodatabase in ArcMap.
Check the “browse files” button
in the geodatabase on the
disk. By doing the previous, you will
be assured that the model will
work properly, even if when you start, the geodatabase is not loaded in ArcMap.
Step One: Getting the date as text
the date to the output file name ( backup ) you must add
the tool ” Calculation of a value . ” This tool is not in the toolbox, it
available in the Model
Builder “Insert” menu
function get time retrieves
the date and time system .
The type of data in
string converts the date and time system in text string. On the other hand, this chain
contains spaces and special characters, and these are
not allowed in the names
of geodatabases . Therefore you have to remove
them. This is what is the code block for
return time.ctime () .replace
(“:”, “”). replace (“”, “”)
It removes “:” and the spaces in the output chain.
step : Backing up the geodatabase
and drag the “Copy” tool of the “Data Management”
-> “General” toolbox.
Connect , with the “connect” tool of Model
Builder, the Compacting output data with the box
“Copy” by selecting ” Data
in input “.
Now you must connect the calculated value with the Copy box .
On the other hand, there is no particular
field for this value in the Copy tool . Incidentally , we are going to use it as variable, adding its value between “%” in the output file name. We could do it without connecting at all the calculation, but
you must avoid independent processes unconnected in the same model because the order execution
is not insured. The Copy tool can be executed BEFORE calculating
To avoid this , click “Copy”
-> Properties .
Then in the ” Preconditions ” tab check the name of your
This assures you that the
calculation will be done BEFORE performing “Copy”.
Finally , you will
define the backup output .
the output file name, once created as usually by browsing the files and giving a classic name , add to the name of the window “Copy” the output of
” Calculate ” between “%”. When
running the model , Arcgis replaces this chain by the chain Calculate output.
Save the model in
your Toolbox. Now you only have to double
click on this model for the whole process to
take place automatically .