forked from hans/Nominatim
make tables for external data (Tiger and aux) configurable
Introduces two new settings CONST_Use_US_Tiger_Data and CONST_Use_Aux_Location_data, which are disabled by default. When false the corresponding tables are ignored in queries and updates. Aux and tiger tables are no longer created by default. This has to be done by the corresponding import scripts. The former aux table creation can be found in sql/aux_tables.sql for reference.
This commit is contained in:
6
sql/aux_tables.sql
Normal file
6
sql/aux_tables.sql
Normal file
@@ -0,0 +1,6 @@
|
||||
CREATE TABLE location_property_aux () INHERITS (location_property);
|
||||
CREATE INDEX idx_location_property_aux_place_id ON location_property_aux USING BTREE (place_id);
|
||||
CREATE INDEX idx_location_property_aux_parent_place_id ON location_property_aux USING BTREE (parent_place_id);
|
||||
CREATE INDEX idx_location_property_aux_housenumber_parent_place_id ON location_property_aux USING BTREE (parent_place_id, housenumber);
|
||||
GRANT SELECT ON location_property_aux TO "{www-user}";
|
||||
|
||||
@@ -1024,7 +1024,7 @@ BEGIN
|
||||
|
||||
--DEBUG: RAISE WARNING 'placex_insert:END: % % % %',NEW.osm_type,NEW.osm_id,NEW.class,NEW.type;
|
||||
|
||||
RETURN NEW; -- @DIFFUPDATES@ The following is not needed until doing diff updates, and slows the main index process down
|
||||
RETURN NEW; -- %DIFFUPDATES% The following is not needed until doing diff updates, and slows the main index process down
|
||||
|
||||
IF NEW.rank_address > 0 THEN
|
||||
IF (ST_GeometryType(NEW.geometry) in ('ST_Polygon','ST_MultiPolygon') AND ST_IsValid(NEW.geometry)) THEN
|
||||
@@ -1650,6 +1650,7 @@ BEGIN
|
||||
END IF;
|
||||
END IF;
|
||||
|
||||
-- %NOTIGERDATA% IF 0 THEN
|
||||
-- for the USA we have an additional address table. Merge in zip codes from there too
|
||||
IF NEW.rank_search = 26 AND NEW.calculated_country_code = 'us' THEN
|
||||
FOR location IN SELECT distinct postcode from location_property_tiger where parent_place_id = NEW.place_id LOOP
|
||||
@@ -1662,6 +1663,7 @@ BEGIN
|
||||
nameaddress_vector := array_merge(nameaddress_vector, ARRAY[address_street_word_id]);
|
||||
END LOOP;
|
||||
END IF;
|
||||
-- %NOTIGERDATA% END IF;
|
||||
|
||||
-- RAISE WARNING 'ISIN: %', isin_tokens;
|
||||
|
||||
@@ -2257,18 +2259,22 @@ DECLARE
|
||||
hadcountry BOOLEAN;
|
||||
BEGIN
|
||||
--first query tiger data
|
||||
-- %NOTIGERDATA% IF 0 THEN
|
||||
select parent_place_id,'us', 30, postcode, null, 'place', 'house' from location_property_tiger
|
||||
WHERE place_id = in_place_id AND in_housenumber>=startnumber AND in_housenumber <= endnumber
|
||||
INTO for_place_id,searchcountrycode, searchrankaddress, searchpostcode, searchhousename, searchclass, searchtype;
|
||||
IF for_place_id IS NOT NULL THEN
|
||||
searchhousenumber = in_housenumber::text;
|
||||
END IF;
|
||||
|
||||
-- %NOTIGERDATA% END IF;
|
||||
|
||||
-- %NOAUXDATA% IF 0 THEN
|
||||
IF for_place_id IS NULL THEN
|
||||
select parent_place_id,'us', housenumber, 30, postcode, null, 'place', 'house' from location_property_aux
|
||||
WHERE place_id = in_place_id
|
||||
INTO for_place_id,searchcountrycode, searchhousenumber, searchrankaddress, searchpostcode, searchhousename, searchclass, searchtype;
|
||||
END IF;
|
||||
-- %NOAUXDATA% END IF;
|
||||
|
||||
IF for_place_id IS NULL THEN
|
||||
select parent_place_id, calculated_country_code, housenumber, rank_search, postcode, name, class, type from placex
|
||||
|
||||
@@ -100,15 +100,6 @@ CREATE TABLE location_property (
|
||||
);
|
||||
SELECT AddGeometryColumn('location_property', 'centroid', 4326, 'POINT', 2);
|
||||
|
||||
CREATE TABLE location_property_aux () INHERITS (location_property);
|
||||
CREATE INDEX idx_location_property_aux_place_id ON location_property_aux USING BTREE (place_id);
|
||||
CREATE INDEX idx_location_property_aux_parent_place_id ON location_property_aux USING BTREE (parent_place_id);
|
||||
CREATE INDEX idx_location_property_aux_housenumber_parent_place_id ON location_property_aux USING BTREE (parent_place_id, housenumber);
|
||||
GRANT SELECT ON location_property_aux TO "{www-user}";
|
||||
|
||||
CREATE TABLE location_property_tiger (linegeo GEOMETRY, place_id BIGINT, partition INTEGER, parent_place_id BIGINT, startnumber INTEGER, endnumber INTEGER, interpolationtype TEXT, postcode TEXT);
|
||||
GRANT SELECT ON location_property_tiger TO "{www-user}";
|
||||
|
||||
drop table IF EXISTS search_name;
|
||||
CREATE TABLE search_name (
|
||||
place_id BIGINT,
|
||||
|
||||
Reference in New Issue
Block a user