Adds postalcode with country

This commit is contained in:
Guido Fioravantti
2015-11-12 11:06:50 +01:00
parent 0df2845076
commit cb19a8ca08
3 changed files with 113 additions and 0 deletions

View File

@@ -1,3 +1,9 @@
-- Make sure dbs are clean
DELETE FROM global_postal_code_points;
DELETE FROM country_decoder;
DELETE FROM available_services;
DELETE FROM admin0_synonyms;
-- Check that the public function is callable, even with no data
-- It should return NULL
SELECT cdb_geocoder_server.geocode_postalcode_point(session_user, txid_current(), '03204');
@@ -10,5 +16,32 @@ INSERT INTO global_postal_code_points (the_geom, iso3, postal_code, postal_code_
3204
);
INSERT INTO country_decoder (iso3, synonyms) VALUES (
'ESP',
Array['spain', 'Spain', 'ESP']
);
INSERT INTO available_services (adm0_a3, admin0, postal_code_points, postal_code_polygons) VALUES (
'ESP',
't',
't',
't'
);
INSERT INTO admin0_synonyms (adm0_a3, name, name_, rank) VALUES (
'ESP',
'Spain',
'spain',
3
);
-- This should return the polygon inserted above
SELECT cdb_geocoder_server.geocode_postalcode_point(session_user, txid_current(), '03204');
SELECT cdb_geocoder_server.geocode_postalcode_point(session_user, txid_current(), '03204', 'spain');
-- Clean dbs
DELETE FROM global_postal_code_points;
DELETE FROM country_decoder;
DELETE FROM available_services;
DELETE FROM admin0_synonyms;