Skip to content

Commit

Permalink
Identify data_type of output data and use the corresponding method (v…
Browse files Browse the repository at this point in the history
…ector/raster)
  • Loading branch information
janpisl committed Jun 9, 2018
1 parent 82145b8 commit e024b1e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pywps/inout/storage/db/pg.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def _create_schema(self):
return schema_name


def store_output(self, file_name, identifier):
def store_vector_output(self, file_name, identifier):
""" Opens output file, connects to PostGIS database and copies data there
"""
from osgeo import ogr
Expand All @@ -81,11 +81,17 @@ def store_output(self, file_name, identifier):
# returns process identifier (defined within the process)
return identifier

def store_raster_output(self, file_name, identifier):
pass


def store(self, output):
""" Creates reference that is returned to the client (database name, schema name, table name)
"""
self.store_output(output.file, output.identifier)
if output.output_format.data_type == 0:
self.store_vector_output(output.file, output.identifier)
elif output.output_format.data_type == 0:
self.store_raster_output(output.file, output.identifier)
url = '{}.{}.{}'.format(self.dbname, self.schema_name, output.identifier)
# returns value for database storage defined in the STORE_TYPE class,
# name of the output file and a reference
Expand Down

0 comments on commit e024b1e

Please sign in to comment.