Skip to content

Instantly share code, notes, and snippets.

@djtfmartin
Created August 1, 2017 10:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djtfmartin/a4f1a4a421231a7df4cd2ce8d5d23e19 to your computer and use it in GitHub Desktop.
Save djtfmartin/a4f1a4a421231a7df4cd2ce8d5d23e19 to your computer and use it in GitHub Desktop.
create table nvc_scotland (pid integer, name varchar(255), the_geom geometry, the_geom_4326 geometry);
insert into nvc_scotland(pid, name, the_geom)
SELECT nextval('objects_id_seq'::regclass), commun_cat, ST_UNION(the_geom) FROM "65" where commun_cat='A, Aquatic Communities' GROUP BY commun_cat;
insert into nvc_scotland(pid, name, the_geom)
SELECT nextval('objects_id_seq'::regclass), commun_cat, ST_UNION(the_geom) FROM "65" where commun_cat='W, Woodlands' GROUP BY commun_cat;
# Doesnt return.....
insert into nvc_scotland(pid, name, the_geom)
SELECT nextval('objects_id_seq'::regclass), commun_cat, ST_UNION(the_geom) FROM "65" where commun_cat='Mosaic' GROUP BY commun_cat;
insert into nvc_scotland(pid, name, the_geom)
SELECT nextval('objects_id_seq'::regclass), commun_cat, ST_UNION(the_geom) FROM "65" where commun_cat='N/A, Non-standard code' GROUP BY commun_cat;
insert into nvc_scotland(pid, name, the_geom)
SELECT nextval('objects_id_seq'::regclass), commun_cat, ST_UNION(the_geom) FROM "65" where commun_cat='OV, Open Vegetation' GROUP BY commun_cat;
# Hole lies outside shell at or near point - problem
insert into nvc_scotland(pid, name, the_geom)
SELECT nextval('objects_id_seq'::regclass), commun_cat, ST_UNION(the_geom) FROM "65" where commun_cat='U, Calcifugous Grasslands and Montane Communities' GROUP BY commun_cat;
insert into nvc_scotland(pid, name, the_geom)
SELECT nextval('objects_id_seq'::regclass), commun_cat, ST_UNION(the_geom) FROM "65" where commun_cat='OW, Open Water' GROUP BY commun_cat;
insert into nvc_scotland(pid, name, the_geom)
SELECT nextval('objects_id_seq'::regclass), commun_cat, ST_UNION(the_geom) FROM "65" where commun_cat='CG, Calciolous Grassland' GROUP BY commun_cat;
insert into nvc_scotland(pid, name, the_geom)
SELECT nextval('objects_id_seq'::regclass), commun_cat, ST_UNION(the_geom) FROM "65" where commun_cat='M, Mires' GROUP BY commun_cat;
insert into nvc_scotland(pid, name, the_geom)
SELECT nextval('objects_id_seq'::regclass), commun_cat, ST_UNION(the_geom) FROM "65" where commun_cat='S, Swamps and tall-herb fens' GROUP BY commun_cat;
insert into nvc_scotland(pid, name, the_geom)
SELECT nextval('objects_id_seq'::regclass), commun_cat, ST_UNION(the_geom) FROM "65" where commun_cat='H, Heathland' GROUP BY commun_cat;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment