Creation of a table epos.borehole_sld for translating the SLD rules (from https://forge.brgm.fr/svnrepository/epos/trunk/sld/): this operation is not automatic... (see function epos.insert_borehole_sld())
CREATE TABLE epos.borehole_sld
(
pk_rule serial NOT NULL,
name character varying(500),
filtre_purpose_href character varying(500),
filtre_length_greater integer,
filter_length_lessequal integer,
style1_symbol character varying(100),
style1_size numeric,
style1_color character varying(11),
style2_symbol character varying(100),
style2_size numeric,
style2_color character(11),
CONSTRAINT sldpk PRIMARY KEY (pk_rule)
)
Creation of a materialized view borehole_eu_06_sld joining the data and SLD rules. The Mapfile does only contain one Style (CLASS) rule, using the values from the database (performaces are better that way).
CREATE MATERIALIZED VIEW epos.borehole_eu_06_sld AS
SELECT borehole_eu_06.location_wgs84::geometry(Point,4326) AS geom,
borehole_eu_06.boreholeid,
borehole_eu_06.purpose_href,
borehole_eu_06.purpose,
borehole_eu_06.status,
borehole_eu_06.operator,
borehole_eu_06.driller,
borehole_eu_06.drillstartdate,
borehole_eu_06.drillenddate,
borehole_eu_06.startpoint,
borehole_eu_06.inclinationtype,
borehole_eu_06.boreholematerialcustodian,
borehole_eu_06.elevation_m,
borehole_eu_06.boreholelength_m,
sld.name,
sld.style1_symbol,
sld.style1_color,
sld.style1_size,
sld.style2_symbol,
sld.style2_color,
sld.style2_size
FROM epos.borehole_eu_06,
epos.borehole_sld sld
WHERE borehole_eu_06.purpose_href::text = sld.filtre_purpose_href::text AND borehole_eu_06.boreholelength_m > sld.filtre_length_greater::double precision AND borehole_eu_06.boreholelength_m <= sld.filter_length_lessequal::double precision
WITH DATA;