From 82b29c1d19783fb5dda616adfbcd6bfaf933e8c9 Mon Sep 17 00:00:00 2001 From: Carla Date: Tue, 9 Sep 2014 11:53:13 +0200 Subject: [PATCH] Adds new query for subunit column and modifies ranks --- geocoder/admin0/README.md | 8 +++++--- geocoder/admin0/sql/build_synonym_table.sql | 11 +++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/geocoder/admin0/README.md b/geocoder/admin0/README.md index ffb89dd..6517cc8 100644 --- a/geocoder/admin0/README.md +++ b/geocoder/admin0/README.md @@ -39,13 +39,13 @@ The table contains the following columns to be populated: 3. **notes:** Extra information as the source of the data. Use: 'data source: X'. -4. **rank:** Use '9' for manually curated additions. +4. **rank:** Use '10' for manually curated additions. The following query can be used: ```` -INSERT INTO admin0_synonym_additions (adm0_a3, name, notes, rank) VALUES ($iso3_code, $synonym, $notes, 9) +INSERT INTO admin0_synonym_additions (adm0_a3, name, notes, rank) VALUES ($iso3_code, $synonym, $notes, 10) ```` **Note:** If you have a complete dataset of synonyms to be included, you will need to add it as part of the build script. If you need to add single entries for synonyms, they can be included in the `admin0_synonym_additions` table manually (or using the previously defined SQL query). @@ -63,7 +63,9 @@ INSERT INTO admin0_synonym_additions (adm0_a3, name, notes, rank) VALUES ($iso3_ | 6 | natural earth 10m countries | brk_name | ? | | 7 | natural earth 10m countries | formal_fr | formal french | | 8 | natural earth 10m countries | iso_a2 | 2 digit country code | -| 9 | admin0_synonym_additions | n/a | manually curated additions | +| 9 | natural earth 10m countries | subunit | complete literal name | +| 10 | admin0_synonym_additions | n/a | manually curated additions | + __notes:__ diff --git a/geocoder/admin0/sql/build_synonym_table.sql b/geocoder/admin0/sql/build_synonym_table.sql index ac77b9a..88494cd 100644 --- a/geocoder/admin0/sql/build_synonym_table.sql +++ b/geocoder/admin0/sql/build_synonym_table.sql @@ -73,14 +73,21 @@ SELECT FROM ne_admin0_v3; --- insert manual additions with a rank = 9 +-- insert subunit as name with a rank = 9 +INSERT INTO admin0_synonyms (name, rank, adm0_a3) +SELECT + subunit, 9, adm0_a3 +FROM + ne_admin0_v3; + +-- insert manual additions with a rank = 10 INSERT INTO admin0_synonyms (name, rank, adm0_a3) SELECT name, rank, adm0_a3 FROM admin0_synonym_additions WHERE - rank=9; + rank=10; -- remove all cases where name is NULL DELETE FROM admin0_synonyms WHERE name IS NULL;