Skip to content

Commit 4f9f21f

Browse files
committed
remove state and county data for US and make postcode import optional
1 parent 527c339 commit 4f9f21f

File tree

4 files changed

+13
-9135
lines changed

4 files changed

+13
-9135
lines changed

data/us_state.sql

-2,930
This file was deleted.

data/us_statecounty.sql

-6,198
This file was deleted.

settings/settings.php

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
@define('CONST_Database_Web_User', 'www-data');
1212
@define('CONST_Max_Word_Frequency', '50000');
1313
@define('CONST_Limit_Reindexing', true);
14+
// Set to false to avoid importing extra postcodes for the US.
15+
@define('CONST_Use_Extra_US_Postcodes', true);
1416

1517
// Proxy settings
1618
@define('CONST_HTTP_Proxy', false);

utils/setup.php

+11-7
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,10 @@
156156
{
157157
echo "WARNING: external UK postcode table not found.\n";
158158
}
159-
pgsqlRunScriptFile(CONST_BasePath.'/data/us_statecounty.sql');
160-
pgsqlRunScriptFile(CONST_BasePath.'/data/us_state.sql');
161-
pgsqlRunScriptFile(CONST_BasePath.'/data/us_postcode.sql');
159+
if (CONST_Use_Extra_US_Postcodes)
160+
{
161+
pgsqlRunScriptFile(CONST_BasePath.'/data/us_postcode.sql');
162+
}
162163

163164
if ($aCMDResult['no-partitions'])
164165
{
@@ -509,10 +510,13 @@
509510
$sSQL .= "from placex where postcode is not null group by calculated_country_code,postcode) as x";
510511
if (!pg_query($oDB->connection, $sSQL)) fail(pg_last_error($oDB->connection));
511512

512-
$sSQL = "insert into placex (osm_type,osm_id,class,type,postcode,calculated_country_code,geometry) ";
513-
$sSQL .= "select 'P',nextval('seq_postcodes'),'place','postcode',postcode,'us',";
514-
$sSQL .= "ST_SetSRID(ST_Point(x,y),4326) as geometry from us_postcode";
515-
if (!pg_query($oDB->connection, $sSQL)) fail(pg_last_error($oDB->connection));
513+
if (CONST_Use_Extra_US_Postcodes)
514+
{
515+
$sSQL = "insert into placex (osm_type,osm_id,class,type,postcode,calculated_country_code,geometry) ";
516+
$sSQL .= "select 'P',nextval('seq_postcodes'),'place','postcode',postcode,'us',";
517+
$sSQL .= "ST_SetSRID(ST_Point(x,y),4326) as geometry from us_postcode";
518+
if (!pg_query($oDB->connection, $sSQL)) fail(pg_last_error($oDB->connection));
519+
}
516520
}
517521

518522
if ($aCMDResult['osmosis-init'] || ($aCMDResult['all'] && !$aCMDResult['drop'])) // no use doing osmosis-init when dropping update tables

0 commit comments

Comments
 (0)