...
3. Prepare the data to be used within Union VMS
- Open QGIS
- Click on the "DB manager" plugin button (). On the left panel, expand the "PostGIS" node and should see the connection node you have created before (in this case called union-vms). Expand that node and you should see all the schemas that are used within the Union VMS application.
- To prepare the data you will need to run some SQL scripts. To do that, press the "SQL window" button (). In the new window paste the following SQL script:
Code Block language sql -- CREATE COUNTRIES TABLE CREATE TABLE spatial.countries AS (SELECT a.gid, a.geom AS geom, b.geom AS geom_20, a.cntr_id, c.iso3_code AS code, c.name_engl AS name FROM spatial.ctr_3m AS a, spatial.ctr_20m AS b, spatial.ctr_metadata AS c WHERE a.cntr_id = b.cntr_id AND a.cntr_id = c.cntr_id); ALTER TABLE spatial.countries OWNER TO spatial; -- ADD NECESSARY COLUMNS FOR UNIONVMS ALTER TABLE spatial.countries ADD COLUMN enabled character varying(1) NOT NULL default 'Y'; ALTER TABLE spatial.countries ADD COLUMN enabled_on timestamp without time zone; -- ADD PRIMARY KEY ALTER TABLE spatial.countries ADD PRIMARY KEY (gid); -- ADD SEQUENCE CREATE SEQUENCE spatial.countries_seq INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 256 CACHE 1; ALTER TABLE spatial.countries_seq OWNER TO spatial; -- ADD SPATIAL INDEXES CREATE INDEX spatial_countries_geom_index ON spatial.countries USING gist (geom); CREATE INDEX spatial_countries_geom_20_index ON spatial.countries USING gist (geom_20); -- DROP OLD TABLES DROP TABLE spatial.ctr_3m; DROP TABLE spatial.ctr_20m; DROP TABLE spatial.ctr_metadata; -- UPDATE SERVICE LAYER TABLE INSERT INTO spatial.service_layer(name, layer_desc, provider_format_id, geo_name, srs_code, short_copyright, long_copyright, is_internal, style_geom, style_label, style_label_geom, subtype) VALUES ('Countries', 'Countries', 2, 'uvms:countries', 4326, '© <b>Countries</b>: EuroGeographics for the administrative boundaries.', '© <b>Countries</b>: EuroGeographics for the administrative boundaries.', 'Y', 'countries', 'countries_label', 'countries_label_geom', 'others');
- Press the "Execute (F5)" button.