Skip to main content
`Ctrl`+`K`

# aequilibrae.project.network.LinkTypes

class aequilibrae.project.network.LinkTypes(net)

  Access to the API resources to manipulate the link_types table in the network.

      >>> project = create_example(project_path)

      >>> link_types = project.network.link_types

      # We can get a dictionary of link types in the model
      >>> all_link_types = link_types.all_types()

      # And do a bulk change and save it
      >>> for link_type_id, link_type_obj in all_link_types.items():
      ...     link_type_obj.beta = 1

      # We can save changes for all link types in one go
      >>> link_types.save()

      # or just get one link_type in specific
      >>> default_link_type = link_types.get('y')

      # or just get it by name
      >>> default_link_type = link_types.get_by_name('default')

      # We can change the description of the link types
      >>> default_link_type.description = 'My own new description'

      # Let's say we are using alpha to store lane capacity during the night as 90% of the standard
      >>> default_link_type.alpha = 0.9 * default_link_type.lane_capacity

      # To save this link types we can simply
      >>> default_link_type.save()

      # We can also create a completely new link_type and add to the model
      >>> new_type = link_types.new('a')
      >>> new_type.link_type = 'Arterial'  # Only ASCII letters and *_* allowed # other fields are not mandatory

      # We then save it to the database
      >>> new_type.save()

      # we can even keep editing and save it directly once we have added it to the project
      >>> new_type.lanes = 3
      >>> new_type.lane_capacity = 1100
      >>> new_type.save()

  __init__(net)

  Methods

  `__init__`(net) |
  `all_types`() | Returns a dictionary with all LinkType objects available in the model.
  `delete`(link_type_id) | Removes the link_type with link_type_id from the project
  `get`(link_type_id) | Get a link_type from the network by its link_type_id
  `get_by_name`(link_type) | Get a link_type from the network by its link_type (i.e. name).
  `new`(link_type_id) |
  `save`() |

  Attributes

  `fields` | Returns a FieldEditor class instance to edit the Link_Types table fields and their metadata

  all_types() → dict

    Returns a dictionary with all LinkType objects available in the model. link_type_id as key

  delete(link_type_id: str) → None

    Removes the link_type with link_type_id from the project

  get(link_type_id: str) → LinkType

    Get a link_type from the network by its link_type_id

  get_by_name(link_type: str) → LinkType

    Get a link_type from the network by its link_type (i.e. name)

  new(link_type_id: str) → LinkType
  save()
  property fields: FieldEditor

    Returns a FieldEditor class instance to edit the Link_Types table fields and their metadata