def encode_eo_coverage_set_description( self, dataset_series_set, coverages, number_matched=None, number_returned=None ): if number_matched is None: number_matched = len(coverages) + len(dataset_series_set) if number_returned is None: number_returned = len(coverages) + len(dataset_series_set) root = EOWCS("EOCoverageSetDescription", numberMatched=str(number_matched), numberReturned=str(number_returned)) if coverages: root.append(self.encode_coverage_descriptions(coverages)) if dataset_series_set: root.append(self.encode_dataset_series_descriptions(dataset_series_set)) return root
def encode_eo_coverage_set_description(self, dataset_series_set, coverages, number_matched=None, number_returned=None): if number_matched is None: number_matched = len(coverages) + len(dataset_series_set) if number_returned is None: number_returned = len(coverages) + len(dataset_series_set) root = EOWCS("EOCoverageSetDescription", numberMatched=str(number_matched), numberReturned=str(number_returned)) if coverages: root.append(self.encode_coverage_descriptions(coverages)) if dataset_series_set: root.append( self.encode_dataset_series_descriptions(dataset_series_set)) return root
def encode_contents(self, coverages, dataset_series_set): contents = [] if coverages is not None: contents.extend([ WCS( "CoverageSummary", WCS("CoverageId", coverage.identifier), WCS("CoverageSubtype", self.get_coverage_subtype(coverage))) for coverage in coverages ]) if dataset_series_set is not None: dataset_series_elements = [] for dataset_series in dataset_series_set: footprint = dataset_series.footprint dataset_series_summary = EOWCS("DatasetSeriesSummary") # NOTE: non-standard, ows:WGS84BoundingBox is actually mandatory, # but not available for e.g: empty collections if footprint: minx, miny, maxx, maxy = footprint.extent dataset_series_summary.append( OWS( "WGS84BoundingBox", OWS("LowerCorner", "%f %f" % (miny, minx)), OWS("UpperCorner", "%f %f" % (maxy, maxx)), )) dataset_series_summary.append( EOWCS("DatasetSeriesId", dataset_series.identifier)) # NOTE: non-standard, gml:TimePosition is actually mandatory, # but not available for e.g: empty collections if dataset_series.begin_time and dataset_series.end_time: dataset_series_summary.append( GML( "TimePeriod", GML("beginPosition", isoformat(dataset_series.begin_time)), GML("endPosition", isoformat(dataset_series.end_time)), **{ ns_gml("id"): dataset_series.identifier + "_timeperiod" })) dataset_series_elements.append(dataset_series_summary) if dataset_series_elements: contents.append(WCS("Extension", *dataset_series_elements)) return WCS("Contents", *contents)