mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
Merge branch 'master' of github.com:twain47/Nominatim
This commit is contained in:
@@ -914,7 +914,7 @@ BEGIN
|
|||||||
NEW.geometry_sector := geometry_sector(NEW.partition, NEW.geometry);
|
NEW.geometry_sector := geometry_sector(NEW.partition, NEW.geometry);
|
||||||
|
|
||||||
-- copy 'name' to or from the default language (if there is a default language)
|
-- copy 'name' to or from the default language (if there is a default language)
|
||||||
IF NEW.name is not null AND array_upper(%#NEW.name,1) > 1 THEN
|
IF NEW.name is not null AND array_upper(akeys(NEW.name),1) > 1 THEN
|
||||||
default_language := get_country_language_code(NEW.country_code);
|
default_language := get_country_language_code(NEW.country_code);
|
||||||
IF default_language IS NOT NULL THEN
|
IF default_language IS NOT NULL THEN
|
||||||
IF NEW.name ? 'name' AND NOT NEW.name ? ('name:'||default_language) THEN
|
IF NEW.name ? 'name' AND NOT NEW.name ? ('name:'||default_language) THEN
|
||||||
@@ -1265,7 +1265,7 @@ BEGIN
|
|||||||
|
|
||||||
-- Thought this wasn't needed but when we add new languages to the country_name table
|
-- Thought this wasn't needed but when we add new languages to the country_name table
|
||||||
-- we need to update the existing names
|
-- we need to update the existing names
|
||||||
IF NEW.name is not null AND array_upper(%#NEW.name,1) > 1 THEN
|
IF NEW.name is not null AND array_upper(akeys(NEW.name),1) > 1 THEN
|
||||||
default_language := get_country_language_code(NEW.country_code);
|
default_language := get_country_language_code(NEW.country_code);
|
||||||
IF default_language IS NOT NULL THEN
|
IF default_language IS NOT NULL THEN
|
||||||
IF NEW.name ? 'name' AND NOT NEW.name ? ('name:'||default_language) THEN
|
IF NEW.name ? 'name' AND NOT NEW.name ? ('name:'||default_language) THEN
|
||||||
@@ -2523,8 +2523,8 @@ DECLARE
|
|||||||
numberrange INTEGER;
|
numberrange INTEGER;
|
||||||
rangestartnumber INTEGER;
|
rangestartnumber INTEGER;
|
||||||
place_centroid GEOMETRY;
|
place_centroid GEOMETRY;
|
||||||
partition INTEGER;
|
out_partition INTEGER;
|
||||||
parent_place_id BIGINT;
|
out_parent_place_id BIGINT;
|
||||||
location RECORD;
|
location RECORD;
|
||||||
address_street_word_id INTEGER;
|
address_street_word_id INTEGER;
|
||||||
|
|
||||||
@@ -2561,32 +2561,32 @@ BEGIN
|
|||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
place_centroid := ST_Centroid(linegeo);
|
place_centroid := ST_Centroid(linegeo);
|
||||||
partition := get_partition(place_centroid, 'us');
|
out_partition := get_partition(place_centroid, 'us');
|
||||||
parent_place_id := null;
|
out_parent_place_id := null;
|
||||||
|
|
||||||
address_street_word_id := get_name_id(make_standard_name(in_street));
|
address_street_word_id := get_name_id(make_standard_name(in_street));
|
||||||
IF address_street_word_id IS NOT NULL THEN
|
IF address_street_word_id IS NOT NULL THEN
|
||||||
FOR location IN SELECT * from getNearestNamedRoadFeature(partition, place_centroid, address_street_word_id) LOOP
|
FOR location IN SELECT * from getNearestNamedRoadFeature(out_partition, place_centroid, address_street_word_id) LOOP
|
||||||
parent_place_id := location.place_id;
|
out_parent_place_id := location.place_id;
|
||||||
END LOOP;
|
END LOOP;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF parent_place_id IS NULL THEN
|
IF out_parent_place_id IS NULL THEN
|
||||||
FOR location IN SELECT place_id FROM getNearestParellelRoadFeature(partition, linegeo) LOOP
|
FOR location IN SELECT place_id FROM getNearestParellelRoadFeature(out_partition, linegeo) LOOP
|
||||||
parent_place_id := location.place_id;
|
out_parent_place_id := location.place_id;
|
||||||
END LOOP;
|
END LOOP;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF parent_place_id IS NULL THEN
|
IF out_parent_place_id IS NULL THEN
|
||||||
FOR location IN SELECT place_id FROM getNearestRoadFeature(partition, place_centroid) LOOP
|
FOR location IN SELECT place_id FROM getNearestRoadFeature(out_partition, place_centroid) LOOP
|
||||||
parent_place_id := location.place_id;
|
out_parent_place_id := location.place_id;
|
||||||
END LOOP;
|
END LOOP;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
newpoints := 0;
|
newpoints := 0;
|
||||||
FOR housenum IN startnumber..endnumber BY stepsize LOOP
|
FOR housenum IN startnumber..endnumber BY stepsize LOOP
|
||||||
insert into location_property_tiger (place_id, partition, parent_place_id, housenumber, postcode, centroid)
|
insert into location_property_tiger (place_id, partition, parent_place_id, housenumber, postcode, centroid)
|
||||||
values (nextval('seq_place'), partition, parent_place_id, housenum, in_postcode,
|
values (nextval('seq_place'), out_partition, out_parent_place_id, housenum, in_postcode,
|
||||||
ST_Line_Interpolate_Point(linegeo, (housenum::float-rangestartnumber::float)/numberrange::float));
|
ST_Line_Interpolate_Point(linegeo, (housenum::float-rangestartnumber::float)/numberrange::float));
|
||||||
newpoints := newpoints + 1;
|
newpoints := newpoints + 1;
|
||||||
END LOOP;
|
END LOOP;
|
||||||
@@ -2603,7 +2603,7 @@ DECLARE
|
|||||||
|
|
||||||
newpoints INTEGER;
|
newpoints INTEGER;
|
||||||
place_centroid GEOMETRY;
|
place_centroid GEOMETRY;
|
||||||
partition INTEGER;
|
out_partition INTEGER;
|
||||||
out_parent_place_id BIGINT;
|
out_parent_place_id BIGINT;
|
||||||
location RECORD;
|
location RECORD;
|
||||||
address_street_word_id INTEGER;
|
address_street_word_id INTEGER;
|
||||||
@@ -2612,18 +2612,18 @@ DECLARE
|
|||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
place_centroid := ST_Centroid(pointgeo);
|
place_centroid := ST_Centroid(pointgeo);
|
||||||
partition := get_partition(place_centroid, in_countrycode);
|
out_partition := get_partition(place_centroid, in_countrycode);
|
||||||
out_parent_place_id := null;
|
out_parent_place_id := null;
|
||||||
|
|
||||||
address_street_word_id := get_name_id(make_standard_name(in_street));
|
address_street_word_id := get_name_id(make_standard_name(in_street));
|
||||||
IF address_street_word_id IS NOT NULL THEN
|
IF address_street_word_id IS NOT NULL THEN
|
||||||
FOR location IN SELECT * from getNearestNamedRoadFeature(partition, place_centroid, address_street_word_id) LOOP
|
FOR location IN SELECT * from getNearestNamedRoadFeature(out_partition, place_centroid, address_street_word_id) LOOP
|
||||||
out_parent_place_id := location.place_id;
|
out_parent_place_id := location.place_id;
|
||||||
END LOOP;
|
END LOOP;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF out_parent_place_id IS NULL THEN
|
IF out_parent_place_id IS NULL THEN
|
||||||
FOR location IN SELECT place_id FROM getNearestRoadFeature(partition, place_centroid) LOOP
|
FOR location IN SELECT place_id FROM getNearestRoadFeature(out_partition, place_centroid) LOOP
|
||||||
out_parent_place_id := location.place_id;
|
out_parent_place_id := location.place_id;
|
||||||
END LOOP;
|
END LOOP;
|
||||||
END IF;
|
END IF;
|
||||||
@@ -2633,12 +2633,12 @@ BEGIN
|
|||||||
SELECT postcode from placex where place_id = out_parent_place_id INTO out_postcode;
|
SELECT postcode from placex where place_id = out_parent_place_id INTO out_postcode;
|
||||||
END IF;
|
END IF;
|
||||||
IF out_postcode IS NULL THEN
|
IF out_postcode IS NULL THEN
|
||||||
out_postcode := getNearestPostcode(partition, place_centroid);
|
out_postcode := getNearestPostcode(out_partition, place_centroid);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
newpoints := 0;
|
newpoints := 0;
|
||||||
insert into location_property_aux (place_id, partition, parent_place_id, housenumber, postcode, centroid)
|
insert into location_property_aux (place_id, partition, parent_place_id, housenumber, postcode, centroid)
|
||||||
values (nextval('seq_place'), partition, out_parent_place_id, in_housenumber, out_postcode, place_centroid);
|
values (nextval('seq_place'), out_partition, out_parent_place_id, in_housenumber, out_postcode, place_centroid);
|
||||||
newpoints := newpoints + 1;
|
newpoints := newpoints + 1;
|
||||||
|
|
||||||
RETURN newpoints;
|
RETURN newpoints;
|
||||||
|
|||||||
Reference in New Issue
Block a user