def get_stats(self, file_path, remove_file=False): s = rasterstats.get_raster_statistics(file_path, True) hist = rasterstats.get_histogram(file_path, True) stats = {"stats": s,"hist": hist} # remove tmp file if ( remove_file is True): filesystem.remove(file_path) return stats
def create_histogram(layers): l = layers.split(":") return json.dumps(rasterstats.get_histogram(configGeoserver.get('datadir') + 'data/'+ l[0]+'/'+ l[1] + '/'+ l[1] +'.geotiff', 256))