2 Implementation of the 'add-data' subcommand.
6 # Do not repeat documentation of subcommand classes.
7 # pylint: disable=C0111
8 # Using non-top-level imports to avoid eventually unused imports.
9 # pylint: disable=E0012,C0415
11 LOG = logging.getLogger()
15 Add additional data from a file or an online source.
17 Data is only imported, not indexed. You need to call `nominatim index`
18 to complete the process.
23 group_name = parser.add_argument_group('Source')
24 group = group_name.add_mutually_exclusive_group(required=True)
25 group.add_argument('--file', metavar='FILE',
26 help='Import data from an OSM file or diff file')
27 group.add_argument('--diff', metavar='FILE',
28 help='Import data from an OSM diff file (deprecated: use --file)')
29 group.add_argument('--node', metavar='ID', type=int,
30 help='Import a single node from the API')
31 group.add_argument('--way', metavar='ID', type=int,
32 help='Import a single way from the API')
33 group.add_argument('--relation', metavar='ID', type=int,
34 help='Import a single relation from the API')
35 group.add_argument('--tiger-data', metavar='DIR',
36 help='Add housenumbers from the US TIGER census database.')
37 group = parser.add_argument_group('Extra arguments')
38 group.add_argument('--use-main-api', action='store_true',
39 help='Use OSM API instead of Overpass to download objects')
40 group.add_argument('--osm2pgsql-cache', metavar='SIZE', type=int,
41 help='Size of cache to be used by osm2pgsql (in MB)')
42 group.add_argument('--socket-timeout', dest='socket_timeout', type=int, default=60,
43 help='Set timeout for file downloads.')
47 from nominatim.tokenizer import factory as tokenizer_factory
48 from nominatim.tools import tiger_data, add_osm_data
51 tokenizer = tokenizer_factory.get_tokenizer_for_db(args.config)
52 return tiger_data.add_tiger_data(args.tiger_data,
53 args.config, args.threads or 1,
56 osm2pgsql_params = args.osm2pgsql_options(default_cache=1000, default_threads=1)
57 if args.file or args.diff:
58 return add_osm_data.add_data_from_file(args.file or args.diff,
62 return add_osm_data.add_osm_object('node', args.node,
67 return add_osm_data.add_osm_object('way', args.way,
72 return add_osm_data.add_osm_object('relation', args.relation,