Update entrances schema

This commit is contained in:
Emily Love Watson
2025-08-14 14:37:24 -05:00
parent 048d571e46
commit 823ad5d279
15 changed files with 139 additions and 26 deletions

View File

@@ -41,6 +41,7 @@ EXTRADATA_PARAMS = (
('addressdetails', 'Include a breakdown of the address into elements'),
('extratags', ("Include additional information if available "
"(e.g. wikipedia link, opening hours)")),
('entrances', 'Include a list of tagged entrance nodes'),
('namedetails', 'Include a list of alternative names')
)
@@ -196,6 +197,7 @@ class APISearch:
'excluded': args.exclude_place_ids,
'viewbox': args.viewbox,
'bounded_viewbox': args.bounded,
'entrances': args.entrances,
}
if args.query:
@@ -225,6 +227,7 @@ class APISearch:
_print_output(formatter, results, args.format,
{'extratags': args.extratags,
'namedetails': args.namedetails,
'entrances': args.entrances,
'addressdetails': args.addressdetails})
return 0
@@ -295,6 +298,7 @@ class APIReverse:
_print_output(formatter, napi.ReverseResults([result]), args.format,
{'extratags': args.extratags,
'namedetails': args.namedetails,
'entrances': args.entrances,
'addressdetails': args.addressdetails})
return 0
@@ -358,6 +362,7 @@ class APILookup:
_print_output(formatter, results, args.format,
{'extratags': args.extratags,
'namedetails': args.namedetails,
'entrances': args.entrances,
'addressdetails': args.addressdetails})
return 0
@@ -395,6 +400,8 @@ class APIDetails:
help='Include a list of name keywords and address keywords')
group.add_argument('--linkedplaces', action='store_true',
help='Include a details of places that are linked with this one')
group.add_argument('--entrances', action='store_true',
help='Include a list of tagged entrance nodes')
group.add_argument('--hierarchy', action='store_true',
help='Include details of places lower in the address hierarchy')
group.add_argument('--group_hierarchy', action='store_true',
@@ -434,6 +441,7 @@ class APIDetails:
with napi.NominatimAPI(args.project_dir) as api:
result = api.details(place,
address_details=args.addressdetails,
entrances=args.entrances,
linked_places=args.linkedplaces,
parented_places=args.hierarchy,
keywords=args.keywords,

View File

@@ -142,6 +142,7 @@ class NominatimArgs:
format: str
list_formats: bool
addressdetails: bool
entrances: bool
extratags: bool
namedetails: bool
lang: Optional[str]

View File

@@ -124,20 +124,19 @@ def create_place_entrance_table(conn: Connection, config: Configuration, **_: An
"""
sqlp = SQLPreprocessor(conn, config)
sqlp.run_string(conn, """
-- Table to store location of entrance nodes
CREATE TABLE IF NOT EXISTS place_entrance (
place_id BIGINT NOT NULL,
osm_node_id BIGINT NOT NULL,
type TEXT NOT NULL,
geometry GEOMETRY(Point, 4326) NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS idx_place_entrance_id
ON place_entrance USING BTREE (place_id, osm_node_id) {{db.tablespace.search_index}};
GRANT SELECT ON place_entrance TO "{{config.DATABASE_WEBUSER}}" ;
-- Table to store location of entrance nodes
DROP TABLE IF EXISTS place_entrance;
CREATE TABLE place_entrance (
place_id BIGINT NOT NULL,
entrances JSONB NOT NULL
);
CREATE UNIQUE INDEX idx_place_entrance_place_id ON place_entrance
USING BTREE (place_id) {{db.tablespace.search_index}};
GRANT SELECT ON place_entrance TO "{{config.DATABASE_WEBUSER}}" ;
-- Create an index on the place table for lookups to populate the entrance
-- table
CREATE INDEX IF NOT EXISTS idx_place_entrance_lookup ON place
USING BTREE (osm_id)
WHERE class IN ('routing:entrance', 'entrance');
""")
-- Create an index on the place table for lookups to populate the entrance
-- table
CREATE INDEX IF NOT EXISTS idx_place_entrance_lookup ON place
USING BTREE (osm_id)
WHERE class IN ('routing:entrance', 'entrance');
""")