update documentation for new directory layout

This commit is contained in:
Sarah Hoffmann
2024-06-25 11:42:30 +02:00
parent e2416f90af
commit 139cea5720
16 changed files with 145 additions and 99 deletions

View File

@@ -20,7 +20,7 @@ configuration parameters, see the [Configuration page](../customize/Settings.md)
## `Configuration` class
::: nominatim.config.Configuration
::: nominatim_core.config.Configuration
options:
members:
- get_bool

View File

@@ -12,22 +12,18 @@ in the database.
The library interface is currently in an experimental stage. There might
be some smaller adjustments to the public interface until the next version.
The library also misses a proper installation routine, so some manipulation
of the PYTHONPATH is required. At the moment, use is only recommended for
developers with some experience in Python.
## Installation
To use the Nominatim library, you need access to a local Nominatim database.
Follow the [installation](../admin/Installation.md) and
[import](../admin/Import.md) instructions to set up your database.
It is not yet possible to install it in the usual way via pip or inside a
virtualenv. To get access to the library you need to set an appropriate
`PYTHONPATH`. With the default installation, the python library can be found
under `/usr/local/share/nominatim/lib-python`. If you have installed
Nominatim under a different prefix, adapt the `/usr/local/` part accordingly.
You can also point the `PYTHONPATH` to the Nominatim source code.
The Nominatim frontend library is contained in the 'nominatim-api' package.
To install the package from the source tree directly, run:
pip install packaging/nominatim-api
Usually, you would want to run this in a virtual environment.
### A simple search example
@@ -43,7 +39,7 @@ This code snippet implements a simple search for the town of 'Brugge':
from pathlib import Path
import asyncio
import nominatim.api as napi
import nominatim_api as napi
async def search(query):
api = napi.NominatimAPIAsync(Path('.'))
@@ -61,7 +57,7 @@ This code snippet implements a simple search for the town of 'Brugge':
``` python
from pathlib import Path
import nominatim.api as napi
import nominatim_api as napi
api = napi.NominatimAPI(Path('.'))
@@ -116,7 +112,7 @@ standard 'nominatim' database:
from pathlib import Path
import asyncio
import nominatim.api as napi
import nominatim_api as napi
config_params = {
'NOMINATIM_DATABASE_DSN': 'pgsql:dbname=belgium'
@@ -134,7 +130,7 @@ standard 'nominatim' database:
``` python
from pathlib import Path
import nominatim.api as napi
import nominatim_api as napi
config_params = {
'NOMINATIM_DATABASE_DSN': 'pgsql:dbname=belgium'
@@ -161,7 +157,7 @@ Again searching for 'Brugge', this time with a nicely formatted result:
from pathlib import Path
import asyncio
import nominatim.api as napi
import nominatim_api as napi
async def search(query):
api = napi.NominatimAPIAsync(Path('.'))
@@ -180,7 +176,7 @@ Again searching for 'Brugge', this time with a nicely formatted result:
``` python
from pathlib import Path
import nominatim.api as napi
import nominatim_api as napi
api = napi.NominatimAPI(Path('.'))

View File

@@ -5,26 +5,26 @@ in the query functions of the API object.
## Place identification
The [details](NominatimAPI.md#nominatim.api.core.NominatimAPI.details) and
[lookup](NominatimAPI.md#nominatim.api.core.NominatimAPI.lookup) functions
The [details](NominatimAPI.md#nominatim_api.core.NominatimAPI.details) and
[lookup](NominatimAPI.md#nominatim_api.core.NominatimAPI.lookup) functions
require references to places in the database. Below the possible
types for place identification are listed. All types are dataclasses.
### PlaceID
::: nominatim.api.PlaceID
::: nominatim_api.PlaceID
options:
heading_level: 6
### OsmID
::: nominatim.api.OsmID
::: nominatim_api.OsmID
options:
heading_level: 6
## Geometry types
::: nominatim.api.GeometryFormat
::: nominatim_api.GeometryFormat
options:
heading_level: 6
members_order: source
@@ -33,14 +33,14 @@ types for place identification are listed. All types are dataclasses.
### Point
::: nominatim.api.Point
::: nominatim_api.Point
options:
heading_level: 6
show_signature_annotations: True
### Bbox
::: nominatim.api.Bbox
::: nominatim_api.Bbox
options:
heading_level: 6
show_signature_annotations: True
@@ -54,9 +54,7 @@ orthogonal to restriction by address ranks, which groups places by their
geographic extent.
::: nominatim.api.DataLayer
::: nominatim_api.DataLayer
options:
heading_level: 6
members_order: source

View File

@@ -26,7 +26,7 @@ the placex table:
import asyncio
from pathlib import Path
import sqlalchemy as sa
from nominatim.api import NominatimAPIAsync
from nominatim_api import NominatimAPIAsync
async def print_table_size():
api = NominatimAPIAsync(Path('.'))
@@ -45,7 +45,7 @@ asyncio.run(print_table_size())
## SearchConnection class
::: nominatim.api.SearchConnection
::: nominatim_api.SearchConnection
options:
members:
- scalar

View File

@@ -6,7 +6,7 @@ to instantiate a separate instance for each thread.
### NominatimAPI
::: nominatim.api.NominatimAPI
::: nominatim_api.NominatimAPI
options:
members:
- __init__
@@ -25,7 +25,7 @@ to instantiate a separate instance for each thread.
### NominatimAPIAsync
::: nominatim.api.NominatimAPIAsync
::: nominatim_api.NominatimAPIAsync
options:
members:
- __init__

View File

@@ -12,7 +12,7 @@ functions that allow further processing of the results.
Nominatim takes the result data from multiple sources. The `source_table` field
in the result describes, from which source the result was retrieved.
::: nominatim.api.SourceTable
::: nominatim_api.SourceTable
options:
heading_level: 6
members_order: source
@@ -31,7 +31,7 @@ contains the result place itself and some artificial entries, for example,
for the house number or the country code. This makes processing and creating
a full address easier.
::: nominatim.api.AddressLine
::: nominatim_api.AddressLine
options:
heading_level: 6
members_order: source
@@ -43,7 +43,7 @@ may be used to find a place, when the `keywords` parameter is set. Search
terms are split into terms for the name of the place and search terms for
its address.
::: nominatim.api.WordInfo
::: nominatim_api.WordInfo
options:
heading_level: 6
@@ -53,6 +53,6 @@ Results are always returned with the full list of available names.
### Locale
::: nominatim.api.Locales
::: nominatim_api.Locales
options:
heading_level: 6