Tuesday 11 October 2016

Configuring Geoserver to use a specific postgis geometry column as the default


I have a PostGIS table with two geometry columns, both multipolygon but one with SRID 4326, the other 3857. When publishing the table in Geoserver, I realize that Geoserver defaults to using the first geometry column in the list of columns, but I was wondering if there is a way to configure Geoserver to use a specific geometry column?


I’m not talking about configuring the SLD to render using a specific geometry column, ie:





geom3857




I’m talking about having Geoserver use a specific geometry column as the native SRID and default projection.



Answer



The usual way to deal with this situation is to expose the geometry column you want using a view. Then just point GeoServer at the view rather than the table:


CREATE OR REPLACE VIEW parcels_3857 AS 
SELECT "PARCEL_VIEW".geom_3857 as geom

FROM "PARCEL_VIEW";

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...