Skip to content

Instantly share code, notes, and snippets.

@tjmgis
Last active August 29, 2015 14:20
Show Gist options
  • Save tjmgis/d5c5dccc5bf08245fc1d to your computer and use it in GitHub Desktop.
Save tjmgis/d5c5dccc5bf08245fc1d to your computer and use it in GitHub Desktop.
New BoundaryLine Styling SQL
COPY (SELECT count(*) as total_count, featurecode, descriptiveterm FROM osmm_topo.boundaryline GROUP BY featurecode, descriptiveterm ORDER BY total_count DESC) TO 'C:/temp/boundaryline.csv' WITH CSV HEADER;
ALTER TABLE osmm_topo.boundaryline ADD COLUMN style_description VARCHAR;
COMMIT;
ALTER TABLE osmm_topo.boundaryline ADD COLUMN style_code INTEGER;
COMMIT;
UPDATE osmm_topo.boundaryline SET (style_description, style_code) = ('Parish Boundary', 1) WHERE style_code IS NULL AND featurecode = '10136';
COMMIT;
UPDATE osmm_topo.boundaryline SET (style_description, style_code) = ('District Boundary', 2) WHERE style_code IS NULL AND featurecode = '10131';
COMMIT;
UPDATE osmm_topo.boundaryline SET (style_description, style_code) = ('Electoral Boundary', 3) WHERE style_code IS NULL AND featurecode = '10128';
COMMIT;
UPDATE osmm_topo.boundaryline SET (style_description, style_code) = ('County Boundary', 4) WHERE style_code IS NULL AND featurecode = '10127';
COMMIT;
UPDATE osmm_topo.boundaryline SET (style_description, style_code) = ('Parliamentary Boundary', 5) WHERE style_code IS NULL AND featurecode = '10135';
COMMIT;
This takes 12 minutes to run on a national GB set
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment