With every import (ili2db --import option) of xtf data having a data model with Catalogue data (enumeration values) the Catalogue items are also imported and thus the enumeration values ​​are duplicated. The option --createBasketCol is used because update (ili2db --update option) etc. is planned later. Omitting this option is therefore not a solution.


Test data: The ASTRA model RoadTrafficAccidentLocation is used to explain the problem.

Generate the master database:

  • Create the master database: ili2gpkg --schemaimport --dbfile ./GIS/Data/RoadTrafficAccidentLocation_master.gpkg --createBasketCol --createEnumTabs RoadTrafficAccidentLocation_V2.ili.
  • Import the Catalogue data: ili2gpkg --import --importBid --dbfile ./GIS/Data/RoadTrafficAccidentLocation_master.gpkg RoadTrafficAccidentLocation_Catalogs_V2.xml.

Data collection (survey1):

  • Create the survey1 database RoadTrafficAccidentLocation_survey1.gpkg with QGIS Model Baker (option Source = Interlis (use GeoPackage)).
  • Import of the Catalogue data, equal as with the master database: ili2gpkg --import --importBid --dbfile ./GIS/Data/RoadTrafficAccidentLocation_survey1.gpkg RoadTrafficAccidentLocation_Catalogs_V2.xml.
  • The recorded data must be assigned to a basket (field T_Basket). Therefore generate data records within the tables T_ILI2DB_DATASET and T_ILI2DB_BASEKT:
    • insert into T_ILI2DB_DATASET (datasetName) values ('RoadTrafficAccidentLocation_V2.RoadTrafficAccident');.
    • insert into [T_ILI2DB_BASKET] ([dataset], [topic], [T_Ili_Tid], [attachmentKey], [domains]) values ((select T_Id from T_ILI2DB_DATASET where datasetName = 'RoadTrafficAccidentLocation_V2.RoadTrafficAccident'), 'RoadTrafficAccidentLocation_V2.RoadTrafficAccident', 'fb34beac-1d2b-4466-9a25-f83809d0fe35', 'RoadTrafficAccidentLocation_V2.RoadTrafficAccident', NULL);.
  • Record fictitious data with QGIS.

Import data from survey1 to master:

  • Export from RoadTrafficAccidentLocation_survey1.gpkg: ili2gpkg --export --baskets fb34beac-1d2b-4466-9a25-f83809d0fe35;b01 --dbfile ./GIS/Data/RoadTrafficAccidentLocation_survey1.gpkg RoadTrafficAccidentLocation_survey1.xtf *)
  • Import to master: ili2gpkg --import --importBid --baskets fb34beac-1d2b-4466-9a25-f83809d0fe35;b01 --dbfile ./GIS/Data/RoadTrafficAccidentLocation_master.gpkg RoadTrafficAccidentLocation_survey1.xtf.

*) Without including the basket b01 of the Catalogue data, error messages occur: Error: unknown referenced object RoadTrafficAccidentLocation_V2.RoadTrafficAccidentCatalogs.AccidentSeverityCategory TID 25 referenced from RoadTrafficAccidentLocation_V2.RoadTrafficAccident.Road-traffic-ec483-4ccident.

Problem duplicated catalog data in master:

Catalog items duplicated on each --import

Question: How can it be avoided that the Catalogue data is (respectively must be) included with each import into the master database and thus is duplicated?


1 Answer 1


According to the model RoadTrafficAccidentCatalogs, the catalog items do not have a stable ID. You have to overrule the model.

One way to do this: use --createTidCol at schemaimport time and --importTid at data import time, and --exportTid at data export time.

Another way is: use the ili2db.oid metaattribute in a metaattibute file and option --iliMetaAttrs at schema import time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.