Merge pull request #2234 from darkshredder/add-man-page

Added Manual page for Nominatim tool
This commit is contained in:
Sarah Hoffmann 2021-03-29 14:25:10 +02:00 committed by GitHub
commit f9517e9143
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 1095 additions and 33 deletions

View File

@ -6,7 +6,7 @@ runs:
steps:
- name: Install prerequisites
run: |
sudo apt-get install -y -qq libboost-system-dev libboost-filesystem-dev libexpat1-dev zlib1g-dev libbz2-dev libpq-dev libproj-dev libicu-dev python3-psycopg2 python3-pyosmium python3-dotenv python3-psutil python3-jinja2 python3-icu
sudo apt-get install -y -qq libboost-system-dev libboost-filesystem-dev libexpat1-dev zlib1g-dev libbz2-dev libpq-dev libproj-dev libicu-dev python3-psycopg2 python3-pyosmium python3-dotenv python3-psutil python3-jinja2 python3-icu python3-argparse-manpage
shell: bash
- name: Download dependencies

View File

@ -36,6 +36,7 @@ set(BUILD_API on CACHE BOOL "Build everything for the API server")
set(BUILD_MODULE on CACHE BOOL "Build PostgreSQL module")
set(BUILD_TESTS on CACHE BOOL "Build test suite")
set(BUILD_DOCS on CACHE BOOL "Build documentation")
set(BUILD_MANPAGE on CACHE BOOL "Build Manual Page")
set(BUILD_OSM2PGSQL on CACHE BOOL "Build osm2pgsql (expert only)")
#-----------------------------------------------------------------------------
@ -208,6 +209,14 @@ if (BUILD_DOCS)
add_subdirectory(docs)
endif()
#-----------------------------------------------------------------------------
# Manual page
#-----------------------------------------------------------------------------
if (BUILD_MANPAGE)
add_subdirectory(manual)
endif()
#-----------------------------------------------------------------------------
# Installation
#-----------------------------------------------------------------------------

15
manual/CMakeLists.txt Normal file
View File

@ -0,0 +1,15 @@
# Creates and installs manual page
configure_file(${PROJECT_SOURCE_DIR}/manual/create-manpage.tmpl create_manpage.py)
find_program(ARGPARSEMANPAGE argparse-manpage)
ADD_CUSTOM_TARGET(manpage
COMMAND ${ARGPARSEMANPAGE} --pyfile ${CMAKE_CURRENT_BINARY_DIR}/create_manpage.py
--function get_parser --project-name Nominatim
--url https://nominatim.org > ${CMAKE_CURRENT_SOURCE_DIR}/nominatim.1
COMMAND sed -i '/.SH AUTHORS/I,+2 d' ${CMAKE_CURRENT_SOURCE_DIR}/nominatim.1
)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/nominatim.1 DESTINATION share/man/man1 )

View File

@ -0,0 +1,12 @@
#!/usr/bin/env python3
import sys
import os
sys.path.append('@PROJECT_SOURCE_DIR@')
from nominatim.cli import get_set_parser
def get_parser():
parser = get_set_parser(phpcgi_path='@PHPCGI_BIN@')
return parser.parser

1015
manual/nominatim.1 Normal file

File diff suppressed because it is too large Load Diff

View File

@ -179,16 +179,16 @@ class QueryExport:
help='Type of places to output (default: street)')
group.add_argument('--output-format',
default='street;suburb;city;county;state;country',
help="""Semicolon-separated list of address types
(see --output-type). Multiple ranks can be
merged into one column by simply using a
comma-separated list.""")
help=("Semicolon-separated list of address types "
"(see --output-type). Multiple ranks can be "
"merged into one column by simply using a "
"comma-separated list."))
group.add_argument('--output-all-postcodes', action='store_true',
help="""List all postcodes for address instead of
just the most likely one""")
help=("List all postcodes for address instead of "
"just the most likely one"))
group.add_argument('--language',
help="""Preferred language for output
(use local name, if omitted)""")
help=("Preferred language for output "
"(use local name, if omitted)"))
group = parser.add_argument_group('Filter arguments')
group.add_argument('--restrict-to-country', metavar='COUNTRY_CODE',
help='Export only objects within country')
@ -242,11 +242,10 @@ class AdminServe:
def run(args):
run_php_server(args.server, args.project_dir / 'website')
def nominatim(**kwargs):
def get_set_parser(**kwargs):
"""\
Command-line tools for importing, updating, administrating and
querying the Nominatim database.
Initializes the parser and adds various subcommands for
nominatim cli.
"""
parser = CommandlineParser('nominatim', nominatim.__doc__)
@ -276,4 +275,14 @@ def nominatim(**kwargs):
parser.add_subcommand('transition', clicmd.AdminTransition)
return parser
def nominatim(**kwargs):
"""\
Command-line tools for importing, updating, administrating and
querying the Nominatim database.
"""
parser = get_set_parser(**kwargs)
return parser.run(**kwargs)

View File

@ -21,8 +21,8 @@ STRUCTURED_QUERY = (
EXTRADATA_PARAMS = (
('addressdetails', 'Include a breakdown of the address into elements.'),
('extratags', """Include additional information if available
(e.g. wikipedia link, opening hours)."""),
('extratags', ("Include additional information if available "
"(e.g. wikipedia link, opening hours).")),
('namedetails', 'Include a list of alternative names.')
)
@ -49,8 +49,8 @@ def _add_api_output_arguments(parser):
choices=['geojson', 'kml', 'svg', 'text'],
help='Output geometry of results as a GeoJSON, KML, SVG or WKT.')
group.add_argument('--polygon-threshold', type=float, metavar='TOLERANCE',
help="""Simplify output geometry.
Parameter is difference tolerance in degrees.""")
help=("Simplify output geometry."
"Parameter is difference tolerance in degrees."))
class APISearch:
@ -205,8 +205,8 @@ class APIDetails:
objs.add_argument('--place_id', '-p', type=int,
help='Database internal identifier of the OSM object to look up.')
group.add_argument('--class', dest='object_class',
help="""Class type to disambiguated multiple entries
of the same object.""")
help=("Class type to disambiguated multiple entries "
"of the same object."))
group = parser.add_argument_group('Output arguments')
for name, desc in DETAILS_SWITCHES:

View File

@ -29,17 +29,17 @@ class UpdateReplication:
help='Initialise the update process')
group.add_argument('--no-update-functions', dest='update_functions',
action='store_false',
help="""Do not update the trigger function to
support differential updates.""")
help=("Do not update the trigger function to "
"support differential updates."))
group = parser.add_argument_group('Arguments for updates')
group.add_argument('--check-for-updates', action='store_true',
help='Check if new updates are available and exit')
group.add_argument('--once', action='store_true',
help="""Download and apply updates only once. When
not set, updates are continuously applied""")
help=("Download and apply updates only once. When "
"not set, updates are continuously applied"))
group.add_argument('--no-index', action='store_false', dest='do_index',
help="""Do not index the new data. Only applicable
together with --once""")
help=("Do not index the new data. Only applicable "
"together with --once"))
group.add_argument('--osm2pgsql-cache', metavar='SIZE', type=int,
help='Size of cache to be used by osm2pgsql (in MB)')
group = parser.add_argument_group('Download parameters')

View File

@ -39,11 +39,11 @@ class SetupAll:
group.add_argument('--reverse-only', action='store_true',
help='Do not create tables and indexes for searching')
group.add_argument('--no-partitions', action='store_true',
help="""Do not partition search indices
(speeds up import of single country extracts)""")
help=("Do not partition search indices "
"(speeds up import of single country extracts)"))
group.add_argument('--no-updates', action='store_true',
help="""Do not keep tables that are only needed for
updating the database later""")
help="Do not keep tables that are only needed for "
"updating the database later")
group = parser.add_argument_group('Expert options')
group.add_argument('--ignore-errors', action='store_true',
help='Continue import even when errors in SQL are present')

View File

@ -42,7 +42,7 @@
python3-pip python3-setuptools python3-devel \
expat-devel zlib-devel libicu-dev
pip3 install --user psycopg2 python-dotenv psutil Jinja2 PyICU
pip3 install --user psycopg2 python-dotenv psutil Jinja2 PyICU argparse-manpage
#

View File

@ -35,7 +35,7 @@
python3-pip python3-setuptools python3-devel \
expat-devel zlib-devel libicu-dev
pip3 install --user psycopg2 python-dotenv psutil Jinja2 PyICU
pip3 install --user psycopg2 python-dotenv psutil Jinja2 PyICU argparse-manpage
#

View File

@ -30,7 +30,8 @@ export DEBIAN_FRONTEND=noninteractive #DOCS:
postgresql-server-dev-10 postgresql-10-postgis-2.4 \
postgresql-contrib-10 postgresql-10-postgis-scripts \
php php-pgsql php-intl libicu-dev python3-pip \
python3-psycopg2 python3-psutil python3-jinja2 python3-icu git
python3-psycopg2 python3-psutil python3-jinja2 python3-icu git \
python3-argparse-manpage
# The python-dotenv package that comes with Ubuntu 18.04 is too old, so
# install the latest version from pip:

View File

@ -33,7 +33,8 @@ export DEBIAN_FRONTEND=noninteractive #DOCS:
postgresql-server-dev-12 postgresql-12-postgis-3 \
postgresql-contrib-12 postgresql-12-postgis-3-scripts \
php php-pgsql php-intl libicu-dev python3-dotenv \
python3-psycopg2 python3-psutil python3-jinja2 python3-icu git
python3-psycopg2 python3-psutil python3-jinja2 python3-icu git \
python3-argparse-manpage
#
# System Configuration