I've scripted my own wps for GeoServer using the GeoScript Groovy API. I can make a request from inside GeoServer and the process runs smoothly. I'm now trying to use the process as a rendering transformation but am having trouble.
The GeoServer log says:
Caused by: java.sql.SQLException: org.postgresql.util.PSQLException: ERROR: parse error - invalid geometry
Hint: "POLYGON ((-?" <-- parse error at position 12 within geometry
After doing some digging through the GeoServer docs, I found a section on query rewriting which mentions that this might be necessary for "controlling query optimizations (for instance, ensuring that geometry decimation does not prevent point features from being read)". However, there is no example on how to do this.
I looked in the geotools heatmap code and found an invertQuery method, but this is only my second time writing code and I don't understand what it's doing or how it's used. I tried putting the following in my script but it didn't help.
public Query invertQuery(
Query targetQuery, GridGeometry targetGridGeometry) throws ProcessException {
targetQuery.setProperties(null);
Hints hints = targetQuery.getHints()
hints.put(Hints.GEOMETRY_DISTANCE, 0.0)
return targetQuery
So, what the heck is geometry decimation? and how can I amend the above code to avoid the invalid geometry error?
The geometry is in PostGIS if that helps
Edit:
When using the GEOTOOLS_DEVELOPER_LOGGING properties I find the following request:
SELECT "id","name","species","bto_code","mass","incubation_days","rearing_days","ad_inc_dist","fid_inc_dist","ad_rer_dist","fid_rer_dist","buff_inc_dist","buff_rer_dist","date_start","date_end","live_dist","conservation_score","legal_dist",encode(ST_AsEWKB("the_geom"),'base64') as "the_geom" FROM "birds_other"."birds_tst_view" WHERE "the_geom" && ST_GeomFromText('POLYGON ((-? -?, -? ?, ? ?, ? -?, -? -?))', 27700)
So it does indeed look like a bad query as I'm styling a points layer. How do I fix this? The query is automatically generated, so it's not obvious to me.