]> git.openstreetmap.org Git - nominatim.git/blob - lib-sql/tables/location_area.sql
Merge pull request #3989 from lonvia/rework-misc-tests
[nominatim.git] / lib-sql / tables / location_area.sql
1 -- SPDX-License-Identifier: GPL-2.0-only
2 --
3 -- This file is part of Nominatim. (https://nominatim.org)
4 --
5 -- Copyright (C) 2026 by the Nominatim developer community.
6 -- For a full list of authors see the git log.
7
8 DROP TABLE IF EXISTS location_area CASCADE;
9 CREATE TABLE location_area (
10   place_id BIGINT NOT NULL,
11   keywords INTEGER[] NOT NULL,
12   partition SMALLINT NOT NULL,
13   rank_search SMALLINT NOT NULL,
14   rank_address SMALLINT NOT NULL,
15   country_code VARCHAR(2),
16   isguess BOOL NOT NULL,
17   postcode TEXT,
18   centroid GEOMETRY(Point, 4326) NOT NULL,
19   geometry GEOMETRY(Geometry, 4326) NOT NULL
20   );
21
22 CREATE TABLE location_area_large () INHERITS (location_area);
23
24 DROP TABLE IF EXISTS location_area_country;
25 CREATE TABLE location_area_country (
26   place_id BIGINT NOT NULL,
27   country_code varchar(2) NOT NULL,
28   geometry GEOMETRY(Geometry, 4326) NOT NULL
29   ) {{db.tablespace.address_data}};
30
31 CREATE INDEX idx_location_area_country_geometry ON location_area_country
32   USING GIST (geometry) {{db.tablespace.address_index}};