Skip to content

Commit

Permalink
continue proto
Browse files Browse the repository at this point in the history
  • Loading branch information
linogaliana committed Oct 22, 2023
1 parent 9e3356e commit 18493b7
Showing 1 changed file with 25 additions and 29 deletions.
54 changes: 25 additions & 29 deletions misc/prototype_mapshaper.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@
dataset_family = "ADMINEXPRESS"
source = "EXPRESS-COG-CARTO-TERRITOIRE"
territory = "metropole"
path_within_bucket = "test-download3"
path_within_bucket = "test-download4"
crs = 4326
bucket = "projet-cartiflette"


borders="COMMUNE" #tempdf['borders'].iloc[0]
format_output="topojson" #tempdf['format'].iloc[0]
niveau_agreg="DEPARTEMENT"#tempdf['filter_by'].iloc[0]

# DOWNLOAD =========================

Expand All @@ -38,24 +41,23 @@
)


# create_path_bucket(
# {
# "bucket": bucket,
# "path_within_bucket": path_within_bucket,
# "year": layer.year,
# "borders": None,
# "crs": layer.crs,
# "filter_by": "origin",
# "value": "raw",
# "vectorfile_format": layer.format,
# "provider": layer.provider,
# "dataset_family": layer.dataset_family,
# "source": layer.source,
# "territory": layer.territory,
# "filename": rename_basename,
# }
# )

# path_manual = create_path_bucket(
# {
# "bucket": bucket,
# "path_within_bucket": path_within_bucket,
# "year": year,
# "borders": None,
# "crs": 2154,
# "filter_by": "origin",
# "value": "raw",
# "vectorfile_format": "shp",
# "provider": provider,
# "dataset_family": dataset_family,
# "source": source,
# "territory": territory,
# "filename": "COMMUNE.shp",
# }
# )

path = x['IGN']['ADMINEXPRESS']['EXPRESS-COG-CARTO-TERRITOIRE']['metropole'][2022]['paths']['COMMUNE'][0]
path_bucket = path.rsplit("/", maxsplit=1)[0]
Expand All @@ -82,13 +84,7 @@ def download_files_from_list(fs, list_raw_files):
list_raw_files = list_raw_files_level(fs, path_bucket, borders=borders)
download_files_from_list(fs, list_raw_files)


# variables
borders="COMMUNE" #tempdf['borders'].iloc[0]
format_output="topojson" #tempdf['format'].iloc[0]
niveau_agreg="DEPARTEMENT"#tempdf['filter_by'].iloc[0]

os.mkdir(f"{niveau_agreg}/{format_output}/")
os.makedirs(f"{niveau_agreg}/{format_output}/", exist_ok=True)

subprocess.run(
(
Expand All @@ -100,8 +96,8 @@ def download_files_from_list(fs, list_raw_files):
shell=True
)

bucket = "projet-cartiflette"
path_within_bucket = "test-download3"
bucket = bucket
path_within_bucket = path_within_bucket

for values in os.listdir(f"{niveau_agreg}/{format_output}"):
path_s3 = create_path_bucket(
Expand Down

0 comments on commit 18493b7

Please sign in to comment.