You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IF ST_IsEmpty(NEWgeometry) OR NOT ST_IsValid(NEWgeometry) ORST_X(ST_Centroid(NEWgeometry))::textin ('NaN','Infinity','-Infinity') OR ST_Y(ST_Centroid(NEWgeometry))::textin ('NaN','Infinity','-Infinity') THEN
29
+
IF ST_X(ST_Centroid(NEWgeometry))::textin ('NaN','Infinity','-Infinity') OR ST_Y(ST_Centroid(NEWgeometry))::textin ('NaN','Infinity','-Infinity') THEN
30
30
NEWgeometry := ST_buffer(NEWgeometry,0);
31
-
IF ST_IsEmpty(NEWgeometry) OR NOT ST_IsValid(NEWgeometry) ORST_X(ST_Centroid(NEWgeometry))::textin ('NaN','Infinity','-Infinity') OR ST_Y(ST_Centroid(NEWgeometry))::textin ('NaN','Infinity','-Infinity') THEN
31
+
IF ST_X(ST_Centroid(NEWgeometry))::textin ('NaN','Infinity','-Infinity') OR ST_Y(ST_Centroid(NEWgeometry))::textin ('NaN','Infinity','-Infinity') THEN
32
32
RETURN ST_SetSRID(ST_Point(0,0),4326);
33
33
END IF;
34
34
END IF;
@@ -60,7 +60,7 @@ CREATE OR REPLACE FUNCTION debug_geometry_sector(osmid integer, place geometry)
60
60
DECLARE
61
61
NEWgeometry geometry;
62
62
BEGIN
63
-
RAISE WARNING '%',osmid;
63
+
-- RAISE WARNING '%',osmid;
64
64
IF osmid =61315 THEN
65
65
return null;
66
66
END IF;
@@ -1251,6 +1251,9 @@ DECLARE
1251
1251
BEGIN
1252
1252
newpoints :=0;
1253
1253
IF interpolationtype ='odd'OR interpolationtype ='even'OR interpolationtype ='all' THEN
FOR housenum IN startnumber..endnumber BY stepsize LOOP
1309
1313
-- this should really copy postcodes but it puts a huge burdon on the system for no big benefit
1310
1314
-- ideally postcodes should move up to the way
1311
-
insert into placex values (null,'N',prevnode.osm_id,prevnode.class,prevnode.type,NULL,prevnode.admin_level,housenum,prevnode.street,prevnode.isin,null,prevnode.country_code,prevnode.street_place_id,prevnode.rank_address,prevnode.rank_search,false,ST_Line_Interpolate_Point(linegeo, (housenum::float-orginalstartnumber)/originalnumberrange));
1315
+
insert into placex values (null,'N',prevnode.osm_id,prevnode.class,prevnode.type,NULL,prevnode.admin_level,housenum,prevnode.street,prevnode.isin,null,prevnode.country_code,prevnode.street_place_id,prevnode.rank_address,prevnode.rank_search,false,ST_Line_Interpolate_Point(linegeo, (housenum::float-orginalstartnumber::float)/originalnumberrange::float));
1312
1316
newpoints := newpoints +1;
1313
1317
END LOOP;
1314
1318
END IF;
@@ -1340,7 +1344,8 @@ DECLARE
1340
1344
country_code VARCHAR(2);
1341
1345
diameter FLOAT;
1342
1346
BEGIN
1343
-
RAISE WARNING '%',NEW;
1347
+
-- RAISE WARNING '%',NEW;
1348
+
-- RAISE WARNING '%',NEW.osm_id;
1344
1349
1345
1350
-- just block these
1346
1351
IF NEW.class='highway'andNEW.typein ('turning_circle','traffic_signals','mini_roundabout','noexit','crossing') THEN
@@ -1351,6 +1356,10 @@ BEGIN
1351
1356
END IF;
1352
1357
1353
1358
IF ST_IsEmpty(NEW.geometry) OR NOT ST_IsValid(NEW.geometry) OR ST_X(ST_Centroid(NEW.geometry))::textin ('NaN','Infinity','-Infinity') OR ST_Y(ST_Centroid(NEW.geometry))::textin ('NaN','Infinity','-Infinity') THEN
1359
+
IF NEW.osm_type='R' THEN
1360
+
-- invalid multipolygons can crash postgis, don't even bother to try!
1361
+
RETURN NULL;
1362
+
END IF;
1354
1363
NEW.geometry := ST_buffer(NEW.geometry,0);
1355
1364
IF ST_IsEmpty(NEW.geometry) OR NOT ST_IsValid(NEW.geometry) OR ST_X(ST_Centroid(NEW.geometry))::textin ('NaN','Infinity','-Infinity') OR ST_Y(ST_Centroid(NEW.geometry))::textin ('NaN','Infinity','-Infinity') THEN
SELECT word FROM word WHERE word_trigram like' %'and word_trigram % trigramtoken ORDER BY similarity(word_trigram, trigramtoken) DESC, word limit1 into result;
2670
+
2671
+
return result;
2672
+
END;
2673
+
$$
2674
+
LANGUAGE plpgsql;
2675
+
2676
+
CREATE OR REPLACEFUNCTIONget_word_suggestions(srcword TEXT) RETURNS TEXT[]
Copy file name to clipboardExpand all lines: gazetteer/gazetteer-index.sql
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -45,11 +45,11 @@ select 'now'::timestamp;
45
45
--insert into placex select null,'X',nextval,'place','postcodearea',ARRAY[ROW('name',postcodeareaname)::keyvalue],null,null,null,null,null,'gb',null,15,23,false,geometry from gb_postcode join gb_postcodearea on (substring(postcode from '^([A-Z][A-Z]?)[0-9][0-9A-Z]? [0-9]$') = postcodeareaid) where postcode ~ '^[A-Z][A-Z]?[0-9][0-9A-Z]? [0-9]$' and ST_GeometryType(geometry) = 'ST_Polygon';
46
46
47
47
select'now'::timestamp;
48
-
insert into placex select*from place where osm_type ='N'order by geometry_sector(geometry);
48
+
insert into placex select*from place where osm_type ='N';-- order by geometry_sector(geometry);
49
49
select'now'::timestamp;
50
-
insert into placex select*from place where osm_type ='W'order by geometry_sector(geometry);
50
+
insert into placex select*from place where osm_type ='W';-- order by geometry_sector(geometry);
51
51
select'now'::timestamp;
52
-
insert into placex select*from place where osm_type ='R'order by geometry_sector(geometry);
52
+
insert into placex select*from place where osm_type ='R';-- order by geometry_sector(geometry);
53
53
select'now'::timestamp;
54
54
55
55
-- use this to do a simple index - for the full planet use 'reindex.php'
0 commit comments