+++ /dev/null
--- This data contains Ordnance Survey data © Crown copyright and database right 2010.
--- Code-Point Open contains Royal Mail data © Royal Mail copyright and database right 2010.
--- OS data may be used under the terms of the OS OpenData licence:
--- http://www.ordnancesurvey.co.uk/oswebsite/opendata/licence/docs/licence.pdf
-
-SET statement_timeout = 0;
-SET client_encoding = 'UTF8';
-SET standard_conforming_strings = off;
-SET check_function_bodies = false;
-SET client_min_messages = warning;
-SET escape_string_warning = off;
-
-SET search_path = public, pg_catalog;
-
-SET default_tablespace = '';
-
-SET default_with_oids = false;
-
-CREATE TABLE gb_postcode (
- id integer,
- postcode character varying(9),
- geometry geometry,
- CONSTRAINT enforce_dims_geometry CHECK ((st_ndims(geometry) = 2)),
- CONSTRAINT enforce_srid_geometry CHECK ((st_srid(geometry) = 4326))
-);
-
+++ /dev/null
-SET statement_timeout = 0;
-SET client_encoding = 'UTF8';
-SET check_function_bodies = false;
-SET client_min_messages = warning;
-
-SET search_path = public, pg_catalog;
-
-SET default_tablespace = '';
-
-SET default_with_oids = false;
-
-CREATE TABLE us_postcode (
- postcode text,
- x double precision,
- y double precision
-);
}
$this->pgsqlRunScriptFile(CONST_DataDir.'/data/country_name.sql');
$this->pgsqlRunScriptFile(CONST_DataDir.'/data/country_osm_grid.sql.gz');
- $this->pgsqlRunScriptFile(CONST_DataDir.'/data/gb_postcode_table.sql');
- $this->pgsqlRunScriptFile(CONST_DataDir.'/data/us_postcode_table.sql');
-
- $sPostcodeFilename = CONST_InstallDir.'/gb_postcode_data.sql.gz';
- if (file_exists($sPostcodeFilename)) {
- $this->pgsqlRunScriptFile($sPostcodeFilename);
- } else {
- warn('optional external GB postcode table file ('.$sPostcodeFilename.') not found. Skipping.');
- }
-
- $sPostcodeFilename = CONST_InstallDir.'/us_postcode_data.sql.gz';
- if (file_exists($sPostcodeFilename)) {
- $this->pgsqlRunScriptFile($sPostcodeFilename);
- } else {
- warn('optional external US postcode table file ('.$sPostcodeFilename.') not found. Skipping.');
- }
if ($this->bNoPartitions) {
$this->pgsqlRunScript('update country_name set partition = 0');
public function calculatePostcodes($bCMDResultAll)
{
info('Calculate Postcodes');
+ $this->pgsqlRunScriptFile(CONST_DataDir.'/sql/postcode_tables.sql');
+
+ $sPostcodeFilename = CONST_InstallDir.'/gb_postcode_data.sql.gz';
+ if (file_exists($sPostcodeFilename)) {
+ $this->pgsqlRunScriptFile($sPostcodeFilename);
+ } else {
+ warn('optional external GB postcode table file ('.$sPostcodeFilename.') not found. Skipping.');
+ }
+
+ $sPostcodeFilename = CONST_InstallDir.'/us_postcode_data.sql.gz';
+ if (file_exists($sPostcodeFilename)) {
+ $this->pgsqlRunScriptFile($sPostcodeFilename);
+ } else {
+ warn('optional external US postcode table file ('.$sPostcodeFilename.') not found. Skipping.');
+ }
+
+
$this->db()->exec('TRUNCATE location_postcode');
$sSQL = 'INSERT INTO location_postcode';
--- /dev/null
+DROP TABLE IF EXISTS gb_postcode;
+CREATE TABLE gb_postcode (
+ id integer,
+ postcode character varying(9),
+ geometry geometry,
+ CONSTRAINT enforce_dims_geometry CHECK ((st_ndims(geometry) = 2)),
+ CONSTRAINT enforce_srid_geometry CHECK ((st_srid(geometry) = 4326))
+);
+
+DROP TABLE IF EXISTS us_postcode;
+CREATE TABLE us_postcode (
+ postcode text,
+ x double precision,
+ y double precision
+);
GRANT SELECT ON new_query_log TO "{www-user}" ;
GRANT SELECT ON TABLE country_name TO "{www-user}";
-GRANT SELECT ON TABLE gb_postcode TO "{www-user}";
-GRANT SELECT ON TABLE us_postcode TO "{www-user}";
drop table IF EXISTS word;
CREATE TABLE word (