remove state and county data for US and make postcode import optional

This commit is contained in:
Sarah Hoffmann 2016-03-30 23:21:13 +02:00
parent 527c3390f4
commit 4f9f21f661
4 changed files with 13 additions and 9135 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -11,6 +11,8 @@
@define('CONST_Database_Web_User', 'www-data'); @define('CONST_Database_Web_User', 'www-data');
@define('CONST_Max_Word_Frequency', '50000'); @define('CONST_Max_Word_Frequency', '50000');
@define('CONST_Limit_Reindexing', true); @define('CONST_Limit_Reindexing', true);
// Set to false to avoid importing extra postcodes for the US.
@define('CONST_Use_Extra_US_Postcodes', true);
// Proxy settings // Proxy settings
@define('CONST_HTTP_Proxy', false); @define('CONST_HTTP_Proxy', false);

View File

@ -156,9 +156,10 @@
{ {
echo "WARNING: external UK postcode table not found.\n"; echo "WARNING: external UK postcode table not found.\n";
} }
pgsqlRunScriptFile(CONST_BasePath.'/data/us_statecounty.sql'); if (CONST_Use_Extra_US_Postcodes)
pgsqlRunScriptFile(CONST_BasePath.'/data/us_state.sql'); {
pgsqlRunScriptFile(CONST_BasePath.'/data/us_postcode.sql'); pgsqlRunScriptFile(CONST_BasePath.'/data/us_postcode.sql');
}
if ($aCMDResult['no-partitions']) if ($aCMDResult['no-partitions'])
{ {
@ -509,11 +510,14 @@
$sSQL .= "from placex where postcode is not null group by calculated_country_code,postcode) as x"; $sSQL .= "from placex where postcode is not null group by calculated_country_code,postcode) as x";
if (!pg_query($oDB->connection, $sSQL)) fail(pg_last_error($oDB->connection)); if (!pg_query($oDB->connection, $sSQL)) fail(pg_last_error($oDB->connection));
if (CONST_Use_Extra_US_Postcodes)
{
$sSQL = "insert into placex (osm_type,osm_id,class,type,postcode,calculated_country_code,geometry) "; $sSQL = "insert into placex (osm_type,osm_id,class,type,postcode,calculated_country_code,geometry) ";
$sSQL .= "select 'P',nextval('seq_postcodes'),'place','postcode',postcode,'us',"; $sSQL .= "select 'P',nextval('seq_postcodes'),'place','postcode',postcode,'us',";
$sSQL .= "ST_SetSRID(ST_Point(x,y),4326) as geometry from us_postcode"; $sSQL .= "ST_SetSRID(ST_Point(x,y),4326) as geometry from us_postcode";
if (!pg_query($oDB->connection, $sSQL)) fail(pg_last_error($oDB->connection)); if (!pg_query($oDB->connection, $sSQL)) fail(pg_last_error($oDB->connection));
} }
}
if ($aCMDResult['osmosis-init'] || ($aCMDResult['all'] && !$aCMDResult['drop'])) // no use doing osmosis-init when dropping update tables if ($aCMDResult['osmosis-init'] || ($aCMDResult['all'] && !$aCMDResult['drop'])) // no use doing osmosis-init when dropping update tables
{ {