Macro lists

Description

The use of macros in Chouette allows the association of a value to a given field. So the user can, through the macro sets, create or associate a value to a field automatically (without going through manual editing). Macro lists are set in a workbench.

Consult macro lists

You can view the macro lists created by your organisation in “Workbench” - “Macro Lists”.

For each macro list, name, comments and the time of update are displayed.

.

The star wheel on each line allows you to edit, consult, delete or execute the macro list.

Creation of a Macro List

Add a new macro

By clicking on “Add a Macro List”, you access the editing form for a new macro list.

First, give a name to your Macro List and choose the macro you want to include.

Then you click on “Add a new instruction”.

Depending on the macro you select, you will have to fill in more or less information.

Whatever instruction you select, you will always be able to add a description of the macro objective and to add a comment:

Add a context into a Macro List

You also have the option to add a context to your Macro List.

This means that the macros in the list are under another condition. So, for example, you can create a macro list with a context “Transport mode > Bus”.

Macros on the list will only be executed on objects with transport mode “Bus”, the other modes will be ignored.

 

Once the context created, add macro the same way as shown above. These macros will be submitted to the set context.

 

When editing your Macro List, the star wheel allows you to duplicate or delete the selected macro or context.

If your macro list contains several macros, the star wheel will suggest you to organize the order of the macros in the list. So the macros in first position will be executed first, and so on.

Execute a Macro List

After creating your Macro List, you can execute it. Go to Macro List section and select “Execute this report” on the star wheel.

The Macro List start and you are redirected to a Macro Run Report. There you will find information about the process and the Macro List that was started :

  • the name of the Macro List Report

  • the name of the Macro List

  • the targeted referential, if there’s one selected

  • the status of Macro List execution (enqueued or done)

On the section “Macros”, you will find a message and a link for each resource processed by the macro with its criticality (success, warning, or error).

Type of Macros

Create a code

With the instruction “Create a code”, the user can create a code on the selected model (stop areas, lines, or vehicle journeys) from the value of another attribute (on another code in the same model or another attribute in the model).

When editing the macro, the user can set :

  • The target model: stop areas, lines, or vehicle journeys

  • The attribute or code that is used as source, i.e. from which the new code will be created.

  • The source pattern, when the value of the source code or attribute is used in part.

  • The target code space where the new code will be created.

  • The target pattern, when the source code or attribute must be modified to generate the new code

Associate shapes according stop areas

The user can add the “Associate Shapes according stop areas” macro to the list.

Before executing this macro, you must make sure that you have imported or created shapes into Chouette.

When the macro is executed, a shape will be associated with a journey pattern if :

  • The journey pattern does not have an associated shape yet

  • All stops in the journey pattern are geographically close to the coordinates of the shape

  • The length of the shape is a short as possible for the stops. If two shapes are similar, Chouette will take the shorter shape in relation to the stop areas.

Associate shapes according code

The user can add the “Associate Shapes according code” macro to the list.

Before executing this macro, you must make sure that you have imported or created shapes into Chouette.

When the macro is executed, a shape will be associated with a journey pattern if :

  • The journey pattern does not have an associated shape yet

  • The shape code value is equal to the journey pattern name

Define Stop Areas compass bearing from Shapes

The user can add the Macro “Define Stop Areas compass bearing from Shapes”.

When a stop area does not have a set compass bearing, it can be updated according to shapes of the journey pattern that serves this stop area.

When the stop area is served by several journey pattern, Chouette use average compass bearing of the shapes associated.

If a stop already has a compass bearing, it will not be change by the macro.

When executing the instruction, you must choose a data set as the target. Only stops in this data set will be considered by the macro.

Create Referent Stop Area

The user can use the macro “Create Referent Stop Area” to automatically create referring stops when there are two or more stops with very close coordinates and compass bearing. The tolerance is 15 m for position and 15 degrees (+/- 7,5°) on compass bearing.

The Referent Stop Area will be used in place of the stop areas it is associated with.

If a referent stop area already exists with the same criteria, it will not be created again by the instruction.

The algorithm for creating a referent stop area in Chouette is based on several criteria. A stop will be created as a referent of other stops with :

  • the average position of all the stops grouped together

  • the average compass bearing of all grouped stops

  • the largest name of all the grouped stops

  • the same type of stop areas

Once the macro list is created, you can execute it.

If no target is selected, the macro will take into account all the stops in your referential.

Associate Stop Areas with a Referent

The user can use the “Associate Stop Areas with a Referent” macro to associate his stop areas with created referent stop areas that have close coordinates and compass bearing.

 

When executing this instruction, there is no need to choose a target. The macro will process all the stop areas owned by your organisation.

Define postal address

Users can use the "Define postal address" macro to define the city and zip code of an object.

This macro can be executed on stop areas, entrances and points of interest:

These two attributes will be calculated according to the geographical coordinates and can be consulted in the stop areas referential:

Define Referent attribute from Particular value

The user can select the "Define Referent attribute from Particular value" macro to define a Referent attribute based on the attributes provided by the particular stop areas. The macro can be executed on stops or company.

For example, the user can define the zip code of the Referent stop areas using the zip codes provided by the particular stop areas.

Condition for defining the value:

  • If all the particulars in a given Referent provide the same value (ignoring Individuals with no value), this common value is used to define the Referent’s attribute.

  • If the attribute is already defined in the Referent's model, the current value is left unchanged by the instruction.

  • If the instruction set does not find a common value for Particulars, the Referent attribute remains unchanged.

Define Journey Pattern duration from passing time

The user can use the "Define Journey Pattern duration from passing time" macro to update the journey patterns based on the average duration between the arrival and departure times of the vehicle journeys.

When this instruction is executed, a dataset must be selected as the target. The calculation will be performed only on the missions in the target dataset.

Define Journey Pattern distances from Shapes

The user can use the "Define Journey Pattern distances from Shapes" macro to update journey pattern according to the distance provided by the associated shapes.

Delete all Vehicle Journeys

The user can use the "Delete all Vehicle Journeys" macro to clean up all the trips in a dataset.

When this instruction set is executed, a dataset must be specified as the target. All vehicle journeys on this target will then be automatically deleted.

Update attribute from Referent

The user can use the "Update attribute from Referent" macro to update the attributes of a particular stop area or company.

When this macro list is executed, Chouette will update the target model (stop area, company) by filling the selected attribute with values from the Referent.

If the referent has no values, the particulars are not updated. To rewrite the existing values of an particular's attributes, select the "Override existing value" option.