We're running GeoServer with all layers coming from a PostGIS data source. Most people work directly on the PostGIS database, but we have one person sitting 10.000km away, and for him, connecting to PostGIS via a VPN is almost impossible because the latency/connection quality is so bad.

So I created an account for him in GeoServer, under which he works on the PostGIS base via QGIS+WFS. This works perfectly for him (less overhead) basically.

This system has one little flaw: With QGIS, we created a table containing all the SLD data for the layers in the PostGIS database. QGIS seems to manage this in its own way, but it works perfectly when working with QGIS directly on the PostGIS database. But: That one user working on the data via WFS/GeoServer cannot see these styles. The style management in GeoServer, as far as I'm concerned, is a "closed" system.

Yet, is there any trick whatsoever to make the styles from our PostGIS styles table available in GeoServer, most appreciatedly respecting the relations between the styles and the layers?

The table definition is as follows:

CREATE TABLE public.layer_styles
  id integer NOT NULL DEFAULT nextval('layer_styles_id_seq'::regclass),
  f_table_catalog character varying(256),
  f_table_schema character varying(256),
  f_table_name character varying(256),
  f_geometry_column character varying(256),
  stylename character varying(30),
  styleqml xml,
  stylesld xml,
  useasdefault boolean,
  description text,
  owner character varying(30),
  ui xml,
  update_time timestamp without time zone DEFAULT now(),
  CONSTRAINT layer_styles_pkey PRIMARY KEY (id)

The f_table_name column is a reference to the PostGIS table/layer to which the style applies. stylename is just a unique, freely chosen name. styleqml contains some QGIS-specific information, and stylesld contains the raw SLD code, again including the layers the style applies to.

So if I'm taken correctly, I could, as well, copy all the SLD fields and create them as styles in GeoServer. But since there are some changes sometimes, it would be absolutely great if there was a way to have GeoServer's styles synchronized with this table.

Any ideas?

  • 1
    The main trick I think would be ensuring that the SLD does in fact work, unchanged, in GeoServer. If it does, then you could combine an "on insert" trigger and the GeoServer REST configuration API to ensure that changes made in QGIS are automatically push new SLDs up to GeoServer. – Paul Ramsey Mar 21 '15 at 16:27
  • 1
    That one user working on the data via WFS/GeoServer cannot see these styles. WFS don't have styles associated with them, you apply SLD to WMS. – nmtoken Aug 16 '16 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.