Hello,
I’m trying GeoServer on this dataset :
http://gadm.org/data/shp/CHN_adm.zip
The dataset contains 4 SHP for China. The first one (CHN_ADM0) contains moslty a polygon for the whole of China and some polygons for the islands. If I run :
SELECT st_npoints(geom) FROM uploads.chn_adm0;
It give me about 734 000 points for this polygon. When I render this layer using WMS, GeoServer struggles a little and RAM / CPU consumptions gets quite high very quickly.
I could simplify the SHP or have different versions of the SHP with different levels of resolutions but I wanted to have a solution that would work for any layer, out of the box.
I thought SQL Views would work with a query along those lines:
SELECT ogc_fid, st_simplify(geom, %tolerance%) as geom FROM uploads.chn_adm0
And using viewparams in the URL, I would set the tolerance on the fly and let PostGIS do the work. But it didn’t and gave me the original polygons. Just to be sure, I tried:
SELECT ogc_fid, st_simplify(geom, 900000) as geom FROM uploads.chn_adm0
Which would reduce the number of points to about 9. But when I preview the layer (WMS), it is still the same.
It looks like it doesn’t understand that I’m changing “geom” or something, I’m not sure. “geom” is recognized as Geometry type and I set the SRID (3857)
Do you have any idea what would be wrong with that SQL View? Can it even be done?
Thanks a lot for your help,
Fabien