In case i didn't get it correctly:
1. with any of JDK, the error remains
2. with every table/view of the DB, the error remains
3. the error appears on smaller scale
4. with included layer of Geoserver, no error at all

To isolate the problem, I would raise log level of PostgreSQL log_statement
to 'all', and restart the DB to make sure the change is applied. Then I'll
reproduce the error with layer preview, and check the logged statement in
Postgresql log.

Then i'll find the suspected SELECT statement (that throws error in
GeoServer), and run it in PGadmin (or PSQL). To my knowledge, GeoServer
requests geometry from PostGIS encoded as binary and then as base64, after
forcing the geometry as 2D and subsequently simplofy it. The pattern is as
follows:

SELECT  encode(ST_AsBinary(
                        CASE    WHEN ST_HasArc("geom") 
                                        THEN "geom" 
                                        ELSE ST_Simplify(ST_Force2D("geom"), 
0.0703125, true) 
                                        END),'base64') as "geom" 
FROM ...etc

If your GeoServer store setting disables the 'Support on the fly geometry
simplification' then the geometry processing is different (now without
ST_SIMPLIFY).

I'll check whether the above geometry is valid, by running the query without
binary and base64 encode with the following:

SELECT  ST_ISVALIDREASON(ST_Simplify(ST_Force2D("geom"), 0.0703125, true))
isvalid
FROM ...etc

I got myself in quite similar situation. To my observation, error in
Geoserver was caused by invalid geometry passed by PostGIS, even the
underlying table/view/MV has only valid geometry. The source of problem is
the SIMPLIFY operation i think, as even the following query gives invalid
geometry:

SELECT  ST_ISVALIDREASON(ST_Simplify(ST_Force2D(
        ST_MAKEVALID(geom)
        ), 0.0703125, true)) isvalid
FROM ...etc

In the above, i put MAKEVALID jsut before Force2D and SIMPLIFY, yet the
resulting geometry is invalid. The ST_SIMPLIFY PostGIS  reference
<https://postgis.net/docs/ST_Simplify.html>   warns that "Topology may not
be preserved and may result in invalid geometries. Use (see
ST_SimplifyPreserveTopology) to preserve topology"




--
Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html


_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to