Hey again,
Another error I'm running into when I run create_from_gmns is a unique constraint error. When I try to add my link types to a project, I get the following:
Traceback (most recent call last):
File "//app/userdata/Worked_on_Code/Create_from_gmns.py", line 133, in <module>
project.network.create_from_gmns(link_file, node_file, use_group)
File "/usr/local/lib/python3.11/site-packages/aequilibrae/project/network/network.py", line 253, in create_from_gmns
gmns_builder.doWork()
File "/usr/local/lib/python3.11/site-packages/aequilibrae/project/network/gmns_builder.py", line 174, in doWork
link_types_list = self.save_types_to_aeq()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aequilibrae/project/network/gmns_builder.py", line 348, in save_types_to_aeq
new_type.save()
File "/usr/local/lib/python3.11/site-packages/aequilibrae/project/network/link_type.py", line 23, in save
conn.execute("Insert into link_types (link_type_id, link_type) values(?,?)", data)
sqlite3.IntegrityError: UNIQUE constraint failed: link_types.link_type
I believe it's not recognizing that the centroid _connector in the file is the same as one of the two defaults in AequilibraE. So it reads it into the project and the unique constraint fails.
When I remove the centroid_contector link_type, I get the error below.
Traceback (most recent call last):
File "//app/userdata/Worked_on_Code/Create_from_gmns.py", line 133, in <module>
project.network.create_from_gmns(link_file, node_file, use_group)
File "/usr/local/lib/python3.11/site-packages/aequilibrae/project/network/network.py", line 253, in create_from_gmns
gmns_builder.doWork()
File "/usr/local/lib/python3.11/site-packages/aequilibrae/project/network/gmns_builder.py", line 174, in doWork
link_types_list = self.save_types_to_aeq()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aequilibrae/project/network/gmns_builder.py", line 345, in save_types_to_aeq
new_type =
link_types.new(letters[0])
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aequilibrae/project/network/link_types.py", line 80, in new
raise ValueError(f"Link Type ID ({link_type_id}) already exists in the model. It must be unique.")
ValueError: Link Type ID (m) already exists in the model. It must be unique.
I'm quite confused why either of these errors are happening. I followed the examples on how to add link types and assign them Unique ids, but it's not working. Any help will be greatly appreciated.
Thanks.