+
+ if args.import_data:
+ LOG.warning('Import data')
+ if not args.osm_file:
+ raise UsageError('Missing required --osm-file argument')
+ database_import.import_osm_data(Path(args.osm_file),
+ args.osm2pgsql_options(0, 1),
+ drop=args.drop,
+ ignore_errors=args.ignore_errors)
+
+ if args.load_data:
+ LOG.warning('Load data')
+ with connect(args.config.get_libpq_dsn()) as conn:
+ database_import.truncate_data_tables(conn, args.config.MAX_WORD_FREQUENCY)
+ database_import.load_data(args.config.get_libpq_dsn(),
+ args.data_dir,
+ args.threads or 1)
+
+ with connect(args.config.get_libpq_dsn()) as conn:
+ try:
+ status.set_status(conn, status.compute_database_date(conn))
+ except Exception as exc: # pylint: disable=broad-except
+ LOG.error('Cannot determine date of database: %s', exc)
+
+ if args.index:
+ LOG.warning('Indexing')
+ from ..indexer.indexer import Indexer
+ indexer = Indexer(args.config.get_libpq_dsn(), args.threads or 1)
+ indexer.index_full()