GeoNode / geonode

GeoNode is an open source platform that facilitates the creation, sharing, and collaborative use of geospatial data.
https://geonode.org/
Other
1.45k stars 1.12k forks source link

"FeatureType Grid Widget" returns empty geometries when a spatial filter is set #8460

Closed afabiani closed 2 years ago

afabiani commented 2 years ago

Expected Behavior

When trying to download a dataset with a spatial filter applied like shown her below, I'd expect the process correctly generating the output file

image

image

Actual Behavior

The Download Process fails with an Empty Geometries Null Pointer Exception error

image

Steps to Reproduce the Problem

  1. Open the grid editor widget on a vectorial dataset
  2. Create a map filter
  3. Try to download the filtered data

Specifications

luorlandini commented 2 years ago

after some investigation, the problem seems to be on the geoserver side

this is the request done to geoserver:

url: https://localhost:8081/geoserver/ows?service=WPS&version=1.0.0&REQUEST=Execute&access_token=8K6lZPHv1Vx7poFaxgM8uDE9b0mhgw payload:

<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns="http://www.opengis.net/wps/1.0.0" xmlns:dwn="http://geoserver.org/wps/download" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:wfs="http://www.opengis.net/wfs" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" service="WPS" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
   <ows:Identifier>gs:Download</ows:Identifier>
   <wps:DataInputs>
      <wps:Input>
         <ows:Identifier>layerName</ows:Identifier>
         <wps:Data>
            <wps:LiteralData>geonode:wilayas_58</wps:LiteralData>
         </wps:Data>
      </wps:Input>
      <wps:Input>
         <ows:Identifier>outputFormat</ows:Identifier>
         <wps:Data>
            <wps:LiteralData>application/zip</wps:LiteralData>
         </wps:Data>
      </wps:Input>
      <wps:Input>
         <ows:Identifier>filter</ows:Identifier>
         <wps:Data>
            <wps:ComplexData mimeType="text/xml; subtype=filter/1.1"><![CDATA[<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml"><ogc:And><ogc:Intersects><ogc:PropertyName>geometry</ogc:PropertyName><gml:Polygon srsName="EPSG:3857"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>90319.02643363085,3414964.3591960706 90319.02643363085,3991448.246372885 687801.5984746646,3991448.246372885 687801.5984746646,3414964.3591960706 90319.02643363085,3414964.3591960706</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogc:Intersects></ogc:And></ogc:Filter>]]></wps:ComplexData>
         </wps:Data>
      </wps:Input>
      <wps:Input>
         <ows:Identifier>cropToROI</ows:Identifier>
         <wps:Data>
            <wps:LiteralData>false</wps:LiteralData>
         </wps:Data>
      </wps:Input>
   </wps:DataInputs>
   <wps:ResponseForm>
      <wps:ResponseDocument storeExecuteResponse="true" status="true">
         <wps:Output asReference="true">
            <ows:Identifier>result</ows:Identifier>
         </wps:Output>
      </wps:ResponseDocument>
   </wps:ResponseForm>
</wps:Execute>

this is the response about that request:

<?xml version="1.0" encoding="UTF-8"?>
<wps:ExecuteResponse xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="en" service="WPS" serviceInstance="https://master.demo.geonode.org/geoserver/ows?" statusLocation="https://master.demo.geonode.org/geoserver/ows?service=WPS&amp;version=1.0.0&amp;request=GetExecutionStatus&amp;executionId=fba695c2-263a-40b4-aa6d-8b17a90867b4" version="1.0.0">
   <wps:Process wps:processVersion="1.0.0">
      <ows:Identifier>gs:Download</ows:Identifier>
      <ows:Title>Enterprise Download Process</ows:Title>
      <ows:Abstract>Downloads Layer Stream and provides a ZIP.</ows:Abstract>
   </wps:Process>
   <wps:Status creationTime="2021-12-03T15:20:56.688Z">
      <wps:ProcessFailed>
         <ows:ExceptionReport version="1.1.0">
            <ows:Exception exceptionCode="NoApplicableCode">
               <ows:ExceptionText>Process failed during execution
java.lang.IllegalStateException: Got an empty feature collection.
Got an empty feature collection.</ows:ExceptionText>
            </ows:Exception>
         </ows:ExceptionReport>
      </wps:ProcessFailed>
   </wps:Status>
</wps:ExecuteResponse>

mapstore send wps:Data, unless the ogc filter is not valid for geoserver, the problem seems to be on that side

giohappy commented 2 years ago

Notice that when the same polygon is set a ROI input to the WPS process, everything works fine. Attributes filters are also working fine.

giohappy commented 2 years ago

Issue moved to GeoNode/geonode-mapstore-client #852 via ZenHub