mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-14 01:47:57 +00:00
Updates layer selection to allow optional default
- Modifies layer argument handling to permit no default layers appropriate. - Update the help text for the layer parameter in the reverse command
This commit is contained in:
@@ -104,7 +104,7 @@ def _get_locales(args: NominatimArgs, config: Configuration) -> napi.Locales:
|
||||
return napi.Locales()
|
||||
|
||||
|
||||
def _get_layers(args: NominatimArgs, default: napi.DataLayer) -> Optional[napi.DataLayer]:
|
||||
def _get_layers(args: NominatimArgs, default: Optional[napi.DataLayer]) -> Optional[napi.DataLayer]:
|
||||
""" Get the list of selected layers as a DataLayer enum.
|
||||
"""
|
||||
if not args.layers:
|
||||
@@ -193,7 +193,7 @@ class APISearch:
|
||||
raise UsageError(f"Unsupported format '{args.format}'. "
|
||||
'Use --list-formats to see supported formats.')
|
||||
|
||||
layers = _get_layers(args, napi.DataLayer.ADDRESS | napi.DataLayer.POI)
|
||||
layers = _get_layers(args, None)
|
||||
|
||||
try:
|
||||
with napi.NominatimAPI(args.project_dir) as api:
|
||||
@@ -262,7 +262,7 @@ class APIReverse:
|
||||
group.add_argument('--layer', metavar='LAYER',
|
||||
choices=[n.name.lower() for n in napi.DataLayer if n.name],
|
||||
action='append', required=False, dest='layers',
|
||||
help='OSM id to lookup in format <NRW><id> (may be repeated)')
|
||||
help='Restrict results to one or more layers (may be repeated)')
|
||||
|
||||
_add_api_output_arguments(parser)
|
||||
_add_list_format(parser)
|
||||
|
||||
Reference in New Issue
Block a user