from owslib.wfs import WebFeatureService # URL of the GeoServer's WFS endpoint #wfs_url = 'https://www.chennaifloodsdss.in/geohorr/ChennaiDSS/ows' wfs_url = 'https://geoserver.rimes.int:8443/geoserver/ows' # Connect to the WFS wfs = WebFeatureService(wfs_url, version='2.0.0') # Adjust version as per your server # Get list of available layers layers = list(wfs.contents) print(layers) # Define a function to retrieve data for a specific layer def get_layer_data(layer_name): output = wfs.getfeature(typename=layer_name) with open(f'tngis/{layer_name}.gml', 'wb') as file: file.write(output.read()) # Download data for each layer for layer in layers: print(f"Downloading data for layer: {layer}") get_layer_data(layer) print(f"Downloaded {layer}.gml") print("Data download complete.")