geopython/pywps

Can't get BoundingBoxInput working with PyWPS

geotom opened this issue · 2 comments

Description

Hi. I am struggling to get a bounding box as input working in my process. The input is defined as

BoundingBoxInput(
    'area_of_interest',
    'The area of interest',
    abstract='Define the area of interest',
    crss=['epsg:4326', ],
    default=[0,0,0,0],
    min_occurs=1,
    max_occurs=1
)

It produces a correct Describe response for my process, but I cannot get the execution with a BBOX working:

  1. I need to provide default value to my BoundingBoxInput. Otherwise I would always get a

    <ows:Exception exceptionCode="MissingParameterValue" locator="area_of_interest" >
       <ows:ExceptionText>area_of_interest</ows:ExceptionText>
    </ows:Exception>
    
  2. Adding a default value (why?) solved my first issue in 1) I now get an input "area_of_interest" in my request handler function. But I cannot access it's properties with request.inputs['area_of_interest'][0].data. Its value is always None

  3. I have no clue what input format I need to provide. So far I used an input like

    <wps:Input>
        <ows:Identifier>area_of_interest</ows:Identifier>
        <wps:Data>
            <wps:BoundingBoxData crs="EPSG:4326" dimensions="2">
                <ows:LowerCorner>-90.0 -45.0</ows:LowerCorner>
                <ows:UpperCorner>90.0 45.0</ows:UpperCorner>
            </wps:BoundingBoxData>
        </wps:Data>
    </wps:Input>
    

Is this a bug? Or do I miss something here? I find the BoundingBox input is very purely documented and haven't found one proper example.

Environment

  • operating system:
  • Python version: 3.8
  • PyWPS version: 4.5.1
  • source/distribution
  • git clone
  • Debian
  • PyPI
  • zip/tar.gz
  • other (please specify):
  • web server
  • Apache/mod_wsgi
  • CGI
  • other (Gunicorn):

@geotom I find the boundingbox parameter very confusing and we might have issues both in pywps and owslib.

I have looked for an example:
https://github.com/bird-house/emu/blob/master/emu/processes/wps_bbox.py

Running a get request:

http://localhost:5000/wps?version=1.0.0&service=wps&identifier=bbox&request=execute&datainputs=bbox=46,102,47,103

I get this response:

<wps:ProcessOutputs>
    <wps:Output>
      <ows:Identifier>bbox</ows:Identifier>
      <ows:Title>Bounding Box</ows:Title>
      <ows:Abstract>Bounding Box Output.</ows:Abstract>
      <wps:Data>
        <wps:BoundingBoxData crs="None" dimensions="2">
          <ows:LowerCorner> 46.0 102.0 </ows:LowerCorner>
          <ows:UpperCorner> 47.0 103.0 </ows:UpperCorner>
        </wps:BoundingBoxData>
      </wps:Data>
    </wps:Output>
  </wps:ProcessOutputs>

See also #610.

Another example:
https://github.com/cedadev/flamingo/blob/872af1b58208cdaadb5c016934adae07a4c474e3/flamingo/processes/_wps_subset_base.py#L97

Thank you @cehbrecht. I got it working now. It seems I had a general problem where also all other inputs were never received and only default values taken. It seems that pyWPS works as intended.