add indexing of artificial postcodes

This commit is contained in:
Sarah Hoffmann
2017-06-29 21:39:00 +02:00
parent 15dbb6383c
commit 80ef6cbaab
4 changed files with 111 additions and 46 deletions

View File

@@ -500,7 +500,7 @@ if ($aCMDResult['calculate-postcodes'] || $aCMDResult['all']) {
$sSQL = "INSERT INTO location_postcode";
$sSQL .= " (place_id, indexed_status, country_code, postcode, geometry) ";
$sSQL .= "SELECT nextval('seq_place'), 1, country_code,";
$sSQL .= " lower(trim (both ' ' from address->'postcode')) as pc,";
$sSQL .= " upper(trim (both ' ' from address->'postcode')) as pc,";
$sSQL .= " ST_Centroid(ST_Collect(ST_Centroid(geometry)))";
$sSQL .= " FROM placex";
$sSQL .= " WHERE address ? 'postcode' AND address->'postcode' NOT SIMILAR TO '%(,|;)%'";
@@ -523,6 +523,10 @@ if ($aCMDResult['calculate-postcodes'] || $aCMDResult['all']) {
if (!pg_query($oDB->connection, $sSQL)) fail(pg_last_error($oDB->connection));
}
echo "Indexing postcodes....\n";
$sSQL = 'UPDATE location_postcode SET indexed_status = 0';
if (!pg_query($oDB->connection, $sSQL)) fail(pg_last_error($oDB->connection));
}
if ($aCMDResult['osmosis-init']) {