Skip to content

Commit 3f7b468

Browse files
committed
Add BANATIC source to download pipeline
1 parent 3033cf8 commit 3f7b468

File tree

4 files changed

+85
-1
lines changed

4 files changed

+85
-1
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,13 @@ dmypy.json
134134

135135
*.sqlite
136136
*.sqlite*
137+
138+
**/emissions.csv
139+
*.gpkg
140+
*.topojson
141+
*.geojson
142+
*.shp
143+
*.cpg
144+
*.dbf
145+
*.prj
146+
*.shx

cartiflette/constants.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,30 @@
3636
REFERENCES = gpd.GeoDataFrame(REFERENCES, crs=4326)
3737

3838
DOWNLOAD_PIPELINE_ARGS = {
39+
"BANATIC": [
40+
"MinistereInterieur",
41+
"BANATIC",
42+
"PERIMETRE-GROUPEMENTS",
43+
[
44+
"Auvergne-Rhone-Alpes",
45+
"Bourgogne-Franche-Comte",
46+
"Bretagne",
47+
"Centre-Val-de-Loire",
48+
"Corse",
49+
"Grand-Est",
50+
"Guadeloupe",
51+
"Guyane",
52+
"Hauts-de-France",
53+
"Ile-de-France",
54+
"La-Reunion",
55+
"Martinique",
56+
"Normandie",
57+
"Nouvelle-Aquitaine",
58+
"Occitanie",
59+
"Pays-de-la-Loire",
60+
"Provence-Alpes-Cote-d-Azur",
61+
],
62+
],
3963
"ADMIN-EXPRESS": [
4064
"IGN",
4165
"ADMINEXPRESS",

cartiflette/download/scraper.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,10 @@ def download_unpack(self, datafile: Dataset, **kwargs) -> DownloadReturn:
435435
root_folder, files_locations = datafile.unpack(protocol="7z")
436436
elif "Zip archive" in filetype:
437437
root_folder, files_locations = datafile.unpack(protocol="zip")
438-
elif "Unicode text" in filetype:
438+
elif (
439+
"Unicode text" in filetype
440+
or "text, with very long lines" in filetype
441+
):
439442
# copy in temp directory without processing
440443
root_folder = tempfile.mkdtemp()
441444
with open(temp_archive_file_raw, "rb") as f:

cartiflette/utils/sources.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,50 @@
1+
MinistereInterieur:
2+
BANATIC:
3+
PERIMETRE-GROUPEMENTS:
4+
structure: "{url_prefix}?zone={territory}&date={date}&format=D"
5+
territory:
6+
Auvergne-Rhone-Alpes: R84
7+
Bourgogne-Franche-Comte: R27
8+
Bretagne: R53
9+
Centre-Val-de-Loire: R24
10+
Corse: R94
11+
Grand-Est: R44
12+
Guadeloupe: R01
13+
Guyane: R03
14+
Hauts-de-France: R32
15+
Ile-de-France: R11
16+
La-Reunion: R04
17+
Martinique: R02
18+
Normandie: R28
19+
Nouvelle-Aquitaine: R75
20+
Occitanie: R76
21+
Pays-de-la-Loire: R52
22+
Provence-Alpes-Cote-d-Azur: R93
23+
2023:
24+
url_prefix: "https://www.banatic.interieur.gouv.fr/V5/fichiers-en-telechargement/telecharger.php"
25+
date: 01/01/2023
26+
2022:
27+
url_prefix: "https://www.banatic.interieur.gouv.fr/V5/fichiers-en-telechargement/telecharger.php"
28+
date: 01/01/2022
29+
2021:
30+
url_prefix: "https://www.banatic.interieur.gouv.fr/V5/fichiers-en-telechargement/telecharger.php"
31+
date: 01/01/2021
32+
2020:
33+
url_prefix: "https://www.banatic.interieur.gouv.fr/V5/fichiers-en-telechargement/telecharger.php"
34+
date: 01/01/2020
35+
2019:
36+
url_prefix: "https://www.banatic.interieur.gouv.fr/V5/fichiers-en-telechargement/telecharger.php"
37+
date: 01/01/2019
38+
2018:
39+
url_prefix: "https://www.banatic.interieur.gouv.fr/V5/fichiers-en-telechargement/telecharger.php"
40+
date: 01/01/2018
41+
2017:
42+
url_prefix: "https://www.banatic.interieur.gouv.fr/V5/fichiers-en-telechargement/telecharger.php"
43+
date: 01/01/2017
44+
2016:
45+
url_prefix: "https://www.banatic.interieur.gouv.fr/V5/fichiers-en-telechargement/telecharger.php"
46+
date: 01/01/2016
47+
148
IGN:
249

350
ADMINEXPRESS:

0 commit comments

Comments
 (0)