def insert_coverage(coverage_url, dataset_id): """ Inserts a coverage attached to a dataset into the WCST service :param coverage_url: string - url to the coverage to be inserted (can be in any gdal supported format + GML) :param dataset_id: string - the id of the dataset to which this coverage is attached to """ coverage_local_path = RasterUtil.get_gml_path_from_dataset(coverage_url, dataset_id) request = wcst.WCSTInsertRequest(coverage_local_path) executor = wcst.WCSTExecutor(RasterUtil.get_wcst_url()) executor.execute(request)
def insert_coverage(coverage_url, dataset_id, base_url): """ Inserts a coverage attached to a dataset into the WCST service :param coverage_url: string - url to the coverage to be inserted (can be in any gdal supported format + GML) :param dataset_id: string - the id of the dataset to which this coverage is attached to """ coverage_local_path = RasterUtil.get_gml_path_from_dataset(coverage_url, dataset_id) gml_url = base_url + os.path.basename(coverage_local_path) #Execute the wcst insert request request = wcst.WCSTInsertRequest(gml_url) executor = wcst.WCSTExecutor(RasterUtil.get_wcst_url()) response = executor.execute(request) #Cleanup os.remove(coverage_local_path) os.remove(coverage_local_path.replace(".xml", ".raster")) return response