The database is no longer showing .zip files
ireneeeeeeeeeee opened this issue · 3 comments
Hi,
I'm trying to download building footprints for Greece. There seems to no longer be .zip files and instead csv.gz files, is there a link to access GeoJSON files for Greece specifically?
When I import the JSON database into ArcGIS it only recognizes the region tiles and not the building footprint info.
Please help, thank you!
Did anyone managed to work with the csv file with QGIS like we used to when it was directly GeoJSON ?
The file contents are line delimited GeoJSON. On Windows you can do the following to extract and rename and ArGIS/QGIS will recognize:
Invoke-WebRequest url.to.csv.gz -outfile local.path.to.csv.gz
7z e local.path.to.csv.gz
Move-Item local.path.to.csv local.path.to.geojsonl
If you want to get all of Greece, you use a script like this and it might save some time:
import pandas as pd
import geopandas as gpd
from shapely.geometry import shape
dataset_links = pd.read_csv("https://minedbuildings.blob.core.windows.net/global-buildings/dataset-links.csv")
greece_links = dataset_links[dataset_links.Location == 'Greece']
for _, row in greece_links.iterrows():
df = pd.read_json(row.Url, lines=True)
df['geometry'] = df['geometry'].apply(shape)
gdf = gpd.GeoDataFrame(df, crs=4326)
gdf.to_file(f"{row.QuadKey}.geojson", driver="GeoJSON")
Edit: updated link for new location
Those csv aren't csv, but instead json.
Here's a code snippet to extract and properly rename.
# url is looked up from dataset-links.csv
path = url.split('/')
gzfile = path[-1]
jsonfile = f'{gzfile[:-6]}json'
with gzip.open(gzfile, 'rb') as gz:
with open(jsonfile, 'wb') as js:
shutil.copyfileobj(gz, js)
os.remove(gzfile)