Hi there, I did this just recently.
You need to export the Tiles layer from the WFS server, then you can setup a Python script which downloads the whole thing.
Here’s a script that will do that for you:
import os
import requests
import pandas as pd
import geopandas as gpd
from tqdm import tqdm
from concurrent.futures import ThreadPoolExecutor
OUTPUT_FOLDER = '3dbag_tiles_download'
def download_file(url):
# Get the file name from the URL
file_name = url.split("/")[-1]
file_path = os.path.join(OUTPUT_FOLDER, file_name)
# Check if the file already exists
if os.path.exists(file_path):
print(f"File already exists, skipping: {file_path}")
return
try:
# Download the file
response = requests.get(url)
# Check if the request was successful
if response.status_code != 200:
print(f"Failed to download {url}. HTTP status code: {response.status_code}")
return
# Save the file to a directory
with open(file_path, 'wb') as file:
file.write(response.content)
except Exception as e:
print(f"Failed to download or save {url}. Error: {str(e)}")
# Load the GeoPackage file
tiles = gpd.read_file("tiles_exported.gpkg", layer='tiles_exported')
# Get the download URLs
urls = pd.concat([tiles['cj_download']]) # Add alt. formats if needed: tiles['obj_download'], tiles['gpkg_download']
# Number of workers in the pool (change to the number of cores on your machine)
num_workers = 16
# Create a ThreadPoolExecutor
with ThreadPoolExecutor(max_workers=num_workers) as executor:
# Use the executor to map the download_file function to the URLs
list(tqdm(executor.map(download_file, urls), total=len(urls), desc="Overall progress", unit="file"))
I’m too new of a user to upload my tiles_exported.gpkg
-file, but you simply export it using the WFS server and the Tiles layer.