Skip to content

Commit

Permalink
Merge pull request #113 from bird-house/fix-112
Browse files Browse the repository at this point in the history
add geojson input to geodata process
  • Loading branch information
huard authored Apr 27, 2021
2 parents 38a72ee + 61f1222 commit 67bc3a6
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions emu/processes/wps_geodata.py
Original file line number Diff line number Diff line change
@@ -4,8 +4,9 @@
Author: Trevor James Smith
"""
from pathlib import Path
from pywps import Process, ComplexOutput
from pywps import Process, ComplexOutput, ComplexInput
from pywps import FORMATS
from pywps.validator.mode import MODE
import logging


@@ -18,7 +19,13 @@

class GeoData(Process):
def __init__(self):
inputs = list()
inputs = [ComplexInput("shape",
"Geometry",
supported_formats=[FORMATS.GEOJSON],
mode=MODE.NONE, # Can be upgraded to STRICT once pywps releases 4.4.3 or 4.5.
min_occurs=0,
max_occurs=1)
]
outputs = [
ComplexOutput(
"raster",
@@ -50,8 +57,13 @@ def __init__(self):

@staticmethod
def _handler(request, response):
import json
response.update_status("PyWPS Process started.", 0)

if "shape" in request.inputs:
LOGGER.info("Loading `shape`")
json.loads(request.inputs["shape"][0].data)

response.outputs['vector'].file = DATA_DIR / "Olympus_Mons.geojson"

response.outputs['raster'].file = DATA_DIR / "Olympus.tif"

0 comments on commit 67bc3a6

Please sign in to comment.