diff --git a/istsoslib/renderers/GCresponseRender.py b/istsoslib/renderers/GCresponseRender.py index f25b6fe0..9366abac 100755 --- a/istsoslib/renderers/GCresponseRender.py +++ b/istsoslib/renderers/GCresponseRender.py @@ -292,6 +292,9 @@ def render_2_0_0(GC,sosConfig): r += " \n" r += " \n" + # add ReferenceSystem tag + if p.referenceSystem: + r += " \n" r += " \n" if o.name != 'GlobalOperations': @@ -427,4 +430,4 @@ def render_2_0_0(GC,sosConfig): r += " \n" r += " " - return r \ No newline at end of file + return r diff --git a/istsoslib/responders/GCresponse.py b/istsoslib/responders/GCresponse.py index fd80e8c0..17e2df17 100755 --- a/istsoslib/responders/GCresponse.py +++ b/istsoslib/responders/GCresponse.py @@ -90,11 +90,12 @@ class Parameter: allowedValues (list): allowed values range (list): ranges """ - def __init__(self,name,use = "optional",allowedValues=[],range=[]): + def __init__(self,name,use = "optional",allowedValues=[],range=[], referenceSystem=False): self.name=name self.use=use self.allowedValues=allowedValues self.range=range + self.referenceSystem=referenceSystem class Operation: """Operation object @@ -111,8 +112,8 @@ def __init__(self,name,get="",post=""): self.get=get self.post=post self.parameters=[] - def addParameter(self,name,use = "optional",allowedValues=[],range=[]): - self.parameters.append(Parameter(name,use,allowedValues,range)) + def addParameter(self,name,use = "optional",allowedValues=[],range=[], referenceSystem=False): + self.parameters.append(Parameter(name,use,allowedValues,range,referenceSystem)) def BuildSensorIdList(pgdb,sosConfig): """Generate the sensor list @@ -197,6 +198,9 @@ def BuildEventTimeRange(pgdb,sosConfig): return [rows[0]["b"],rows[0]["e"]] def BuildEnvelopeMinMax(pgdb,sosConfig): + sosEpsgList = [sosConfig.istsosepsg,]*2 + sosSchemaList = [sosConfig.schema,]*3 + sqlParamsList = sosEpsgList+sosSchemaList+[sosConfig.istsosepsg, sosConfig.schema] sql = """ SELECT st_XMin(envelope) as mix, @@ -205,10 +209,10 @@ def BuildEnvelopeMinMax(pgdb,sosConfig): st_YMax(envelope) as may FROM ( - select ST_ENVELOPE(ST_Collect(ST_Transform(envelope,3857))) as envelope + select ST_ENVELOPE(ST_Collect(ST_Transform(envelope,%s))) as envelope from ( select - ST_ENVELOPE(ST_Collect(ST_Transform(geom_pos,3857))) as envelope + ST_ENVELOPE(ST_Collect(ST_Transform(geom_pos,%s))) as envelope FROM %s.positions, %s.event_time, %s.procedures WHERE @@ -217,12 +221,12 @@ def BuildEnvelopeMinMax(pgdb,sosConfig): id_eti = id_eti_fk union select - ST_ENVELOPE(ST_Collect(ST_Transform(geom_foi,3857))) as envelope + ST_ENVELOPE(ST_Collect(ST_Transform(geom_foi,%s))) as envelope FROM %s.foi ) as g ) as s - """ % ((sosConfig.schema,)*4) + """ % (tuple(sqlParamsList)) result = [0,0,0,0] rows=pgdb.select(sql) if len(rows) == 1: @@ -543,7 +547,7 @@ def __init__(self,pgdb,sosConfig): GetObservation=Operation(name="GetObservation", get = sosConfig.serviceUrl["get"]) GetObservation.addParameter(name="offering", use = "required", allowedValues = BuildOfferingList_2_0_0(pgdb,sosConfig)) GetObservation.addParameter(name="temporalFilter", use = "optional", allowedValues = [], range=BuildEventTimeRange(pgdb,sosConfig)) - GetObservation.addParameter(name="spatialFilter", use = "optional", allowedValues = [], range=BuildEnvelopeMinMax(pgdb,sosConfig)) + GetObservation.addParameter(name="spatialFilter", use = "optional", allowedValues = [], range=BuildEnvelopeMinMax(pgdb,sosConfig), referenceSystem="http://www.opengis.net/def/crs/EPSG/0/"+sosConfig.istsosepsg) GetObservation.addParameter(name="procedure", use = "optional", allowedValues = BuildSensorIdList(pgdb,sosConfig)) GetObservation.addParameter(name="observedProperty", use = "optional", allowedValues = BuildobservedPropertyList(pgdb,sosConfig)) GetObservation.addParameter(name="featureOfInterest", use = "optional", allowedValues = BuildfeatureOfInterestList(pgdb,sosConfig))