Hi Jason,

I don't think this is a technically a bug.  The Process you are using comes from GeoTools; its input assumes that it gets a SimpleFeatureCollection, some attributes, and a filter.  When GeoServer is running a WPS, in your request, the block after "<ows:Identifier>features</ows:Identifier>" is calling for all the features out of PostGIS.  The results are then filtered in memory as you have seen/guessed(1).

I think it is possible to specify a filter when defining the "wps:Reference"; I just never remember how to do so and I struggle to find where it is.

Cheers,

Jim

1. https://github.com/geotools/geotools/blob/main/modules/unsupported/process-feature/src/main/java/org/geotools/process/vector/QueryProcess.java#L53-L55

p.s. Sorry for the duplicate posts.


On 4/27/21 4:25 PM, Jason Newmoyer wrote:
I am seeing some behavior that seems off from what I understand should be happening with the WPS.

Using a PostGIS data store, If I make a WFS GetFeature query, and watch the Postgres logs with log_statement "all" I can see the WHERE clause properly constructed in the query to the database:

Example: http://localhost:8888/geoserver/ows?service=wfs&version=1.1.0&request=GetFeature&TYPENAME=country_boundaries&cql_filter=iso_a2='US'&maxfeatures=10 <http://localhost:8888/geoserver/ows?service=wfs&version=1.1.0&request=GetFeature&TYPENAME=country_boundaries&cql_filter=iso_a2=%27US%27&maxfeatures=10>

produces a SQL query like this: SELECT "gid",encode(ST_AsEWKB("geom"), 'base64') as "geom","... FROM "ne_50m_admin_0_countries_lakes" *WHERE ("iso_a2" = 'US' AND "iso_a2" IS NOT NULL )* LIMIT 1000000

However, If I use the WPS gs:Query process in the same manner with CQL:
<?xml version="1.0" encoding="UTF-8"?><wps:Execute version="1.0.0" service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns="http://www.opengis.net/wps/1.0.0"; xmlns:wfs="http://www.opengis.net/wfs"; xmlns:wps="http://www.opengis.net/wps/1.0.0"; xmlns:ows="http://www.opengis.net/ows/1.1"; 
xmlns:gml="http://www.opengis.net/gml"; xmlns:ogc="http://www.opengis.net/ogc"; xmlns:wcs="http://www.opengis.net/wcs/1.1.1"; xmlns:xlink="http://www.w3.org/1999/xlink"; 
xsi:schemaLocation="http://www.opengis.net/wps/1.0.0  http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd";>
   <ows:Identifier>gs:Query</ows:Identifier>
   <wps:DataInputs>
     <wps:Input>
       <ows:Identifier>features</ows:Identifier>
       <wps:Reference mimeType="text/xml" xlink:href="http://geoserver/wfs"; 
method="POST">
         <wps:Body>
           <wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2" 
xmlns:ngs="http://newmoyergeospatial.com";>
             <wfs:Query typeName="ngs:country_boundaries"/>
           </wfs:GetFeature>
         </wps:Body>
       </wps:Reference>
     </wps:Input>
     <wps:Input>
       <ows:Identifier>filter</ows:Identifier>
       <wps:Data>
         <wps:ComplexData mimeType="text/plain; 
subtype=cql"><![CDATA[iso_a2='US']]></wps:ComplexData>
       </wps:Data>
     </wps:Input>
   </wps:DataInputs>
   <wps:ResponseForm>
     <wps:RawDataOutput mimeType="application/json">
       <ows:Identifier>result</ows:Identifier>
     </wps:RawDataOutput>
   </wps:ResponseForm>
</wps:Execute>
I see a SQL query like this: SELECT "gid",encode(ST_AsEWKB("geom"), 'base64') as "geom", ... FROM "ne_50m_admin_0_countries_lakes" LIMIT 1000000

Its missing the *where clause* so presumably post filtering is happening in memory, which is not ideal. And in some cases a deal breaker.

Bug? Any workarounds to try?

So far have tried using vec:Query, and tried using XML filters vs CQL. Same results.

Thanks.

Jason Newmoyer
Newmoyer Geospatial Solutions
843.606.0424
ja...@newmoyergeospatial.com <mailto:ja...@newmoyergeospatial.com>




_______________________________________________
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


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users


_______________________________________________
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


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to