2021-10-03 18:10:19 +02:00
|
|
|
#!/usr/bin/env python3
|
2021-10-21 22:27:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
# Copyright 2021 Olav63, SebF
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
2021-10-10 16:53:12 +02:00
|
|
|
"""Module des requêtes"""
|
2021-10-03 18:10:19 +02:00
|
|
|
|
|
|
|
|
2021-10-10 16:53:12 +02:00
|
|
|
class Requete:
|
|
|
|
"""Objet requête"""
|
|
|
|
|
2021-10-03 18:10:19 +02:00
|
|
|
nom: str
|
|
|
|
critere: str
|
|
|
|
champs: dict
|
|
|
|
|
|
|
|
def __init__(self, nom, critere, champs):
|
|
|
|
self.nom = nom
|
|
|
|
self.critere = critere
|
|
|
|
self.champs = champs
|
|
|
|
|
|
|
|
|
2021-10-10 16:53:12 +02:00
|
|
|
REQS = []
|
|
|
|
CHAMPS_STATIONNEMENT = {
|
2021-10-03 18:10:19 +02:00
|
|
|
"amenity": {"export_json": "Non", "FR": "aménagement"},
|
|
|
|
"capacity": {"export_json": "Oui", "FR": "nombre d'emplacements"},
|
|
|
|
"access": {"export_json": "Oui", "FR": "accès"},
|
|
|
|
"bicycle_parking": {"export_json": "Oui", "FR": "type"},
|
|
|
|
"covered": {"export_json": "Oui", "FR": "couvert"},
|
|
|
|
"operator": {"export_json": "Oui", "FR": "opérateur"},
|
|
|
|
"operator:type": {"export_json": "Oui", "FR": "type d'opérateur"},
|
|
|
|
"fee": {"export_json": "Oui", "FR": "frais"},
|
|
|
|
"check_date:capacity": {"export_json": "Non", "FR": "date_vérification"},
|
|
|
|
"source": {"export_json": "Non", "FR": "source"},
|
|
|
|
}
|
2021-10-10 16:53:12 +02:00
|
|
|
CHAMPS_POI = {
|
2021-10-03 18:10:19 +02:00
|
|
|
"name": {"export_json": "Oui", "FR": ""},
|
|
|
|
"description": {"export_json": "Oui", "FR": ""},
|
|
|
|
"website": {"export_json": "Oui", "FR": ""},
|
|
|
|
"addr:housenumber": {"export_json": "Oui", "FR": ""},
|
|
|
|
"addr:street": {"export_json": "Oui", "FR": ""},
|
|
|
|
"addr:postcode": {"export_json": "Oui", "FR": ""},
|
|
|
|
"addr:city": {"export_json": "Oui", "FR": ""},
|
|
|
|
"contact:email": {"export_json": "Oui", "FR": "email"},
|
|
|
|
"contact:twitter": {"export_json": "Oui", "FR": "Twitter"},
|
|
|
|
"contact:facebook": {"export_json": "Oui", "FR": "Facebook"},
|
|
|
|
"contact:phone": {"export_json": "Oui", "FR": "Téléphone"},
|
|
|
|
"network": {"export_json": "Oui", "FR": "Réseau"},
|
|
|
|
"office": {"export_json": "Oui", "FR": "Bureau"},
|
|
|
|
"opening_hours": {"export_json": "Oui", "FR": "Horaires"},
|
|
|
|
}
|
2021-10-10 16:53:12 +02:00
|
|
|
CHAMPS_ADRESSE = {
|
2021-10-03 18:10:19 +02:00
|
|
|
"api_adresse:geometry:coordinates:lon": {
|
|
|
|
"export_json": "Non",
|
|
|
|
"FR": "lon_adresse_etalab",
|
|
|
|
},
|
|
|
|
"api_adresse:geometry:coordinates:lat": {
|
|
|
|
"export_json": "Non",
|
|
|
|
"FR": "lat_adresse_etalab",
|
|
|
|
},
|
|
|
|
"api_adresse:properties:label": {"export_json": "Non", "FR": "adresse_etalab"},
|
|
|
|
"api_adresse:properties:score": {"export_json": "Non", "FR": "score_etalab"},
|
|
|
|
"api_adresse:properties:housenumber": {"export_json": "Non", "FR": "numero_etalab"},
|
|
|
|
"api_adresse:properties:type": {"export_json": "Non", "FR": "type_etalab"},
|
|
|
|
"api_adresse:properties:name": {
|
|
|
|
"export_json": "Non",
|
|
|
|
"FR": "numero_et_voie_etalab",
|
|
|
|
},
|
|
|
|
"api_adresse:properties:postcode": {
|
|
|
|
"export_json": "Non",
|
|
|
|
"FR": "code_postal_etalab",
|
|
|
|
},
|
|
|
|
"api_adresse:properties:citycode": {
|
|
|
|
"export_json": "Non",
|
|
|
|
"FR": "code_INSEE_etalab",
|
|
|
|
},
|
|
|
|
"api_adresse:properties:city": {"export_json": "Non", "FR": "ville_etalab"},
|
|
|
|
"api_adresse:properties:street": {"export_json": "Non", "FR": "rue_etalab"},
|
|
|
|
}
|
|
|
|
|
2021-10-21 22:06:01 +02:00
|
|
|
# pylint: disable=C0301
|
|
|
|
STATIONNEMENT_NON_PUBLIC_REQ = r'nwr["amenity"="bicycle_parking"]["access"~"(no|permit|private|customers|permissive)"](area:aire_de_recherche);'
|
2021-11-01 21:12:11 +01:00
|
|
|
REQS.append(
|
2021-10-10 16:53:12 +02:00
|
|
|
Requete(
|
2021-10-21 22:06:01 +02:00
|
|
|
"stationnements_velos_non_publics",
|
|
|
|
STATIONNEMENT_NON_PUBLIC_REQ,
|
2021-10-10 16:53:12 +02:00
|
|
|
dict(CHAMPS_STATIONNEMENT, **CHAMPS_ADRESSE),
|
2021-10-03 18:10:19 +02:00
|
|
|
)
|
2021-11-01 21:12:11 +01:00
|
|
|
)
|
2021-10-03 18:10:19 +02:00
|
|
|
|
2021-10-10 16:53:12 +02:00
|
|
|
REQS.append(
|
|
|
|
Requete(
|
2021-10-21 22:06:01 +02:00
|
|
|
"stationnements_velos_publics",
|
2021-10-10 18:54:19 +02:00
|
|
|
# pylint: disable=C0301
|
2021-10-21 22:06:01 +02:00
|
|
|
rf'nwr["amenity"="bicycle_parking"](area:aire_de_recherche); - {STATIONNEMENT_NON_PUBLIC_REQ}',
|
2021-10-10 16:53:12 +02:00
|
|
|
dict(CHAMPS_STATIONNEMENT, **CHAMPS_ADRESSE),
|
2021-10-03 18:10:19 +02:00
|
|
|
)
|
|
|
|
)
|
2021-11-01 21:12:11 +01:00
|
|
|
|
2021-10-10 16:53:12 +02:00
|
|
|
CHAMP_LOCAL = {"service:bicycle:diy": {"export_json": "Non", "FR": ""}}
|
|
|
|
REQS.append(
|
|
|
|
Requete(
|
2021-10-03 18:10:19 +02:00
|
|
|
"ateliers_autoreparation",
|
|
|
|
r'nwr["service:bicycle:diy"="yes"](area:aire_de_recherche);',
|
2021-10-10 16:53:12 +02:00
|
|
|
dict(CHAMP_LOCAL, **CHAMPS_POI, **CHAMPS_ADRESSE),
|
2021-10-03 18:10:19 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2021-10-10 16:53:12 +02:00
|
|
|
CHAMP_LOCAL = {"association": {"export_json": "Non", "FR": ""}}
|
|
|
|
REQS.append(
|
|
|
|
Requete(
|
2021-10-03 18:10:19 +02:00
|
|
|
"associations_velo",
|
|
|
|
r'nwr["association"="bicycle"](area:aire_de_recherche);',
|
2021-10-10 16:53:12 +02:00
|
|
|
dict(CHAMP_LOCAL, **CHAMPS_POI, **CHAMPS_ADRESSE),
|
2021-10-03 18:10:19 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2021-10-10 16:53:12 +02:00
|
|
|
CHAMP_LOCAL = {"craft": {"export_json": "Non", "FR": ""}}
|
|
|
|
REQS.append(
|
|
|
|
Requete(
|
2021-10-03 18:10:19 +02:00
|
|
|
"fabriquants_velo",
|
|
|
|
r'nwr["craft"="bicycle"](area:aire_de_recherche);',
|
2021-10-10 16:53:12 +02:00
|
|
|
dict(CHAMP_LOCAL, **CHAMPS_POI, **CHAMPS_ADRESSE),
|
2021-10-03 18:10:19 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2021-10-10 16:53:12 +02:00
|
|
|
CHAMP_LOCAL = {"shop": {"export_json": "Non", "FR": ""}}
|
|
|
|
REQS.append(
|
|
|
|
Requete(
|
2021-10-03 18:10:19 +02:00
|
|
|
"vendeurs_velo",
|
2021-10-10 18:54:19 +02:00
|
|
|
# pylint: disable=C0301
|
2021-10-09 11:55:00 +02:00
|
|
|
r'nwr["shop"="bicycle"](area:aire_de_recherche); nwr["service:bicycle:retail"="yes"](area:aire_de_recherche);',
|
2021-10-10 16:53:12 +02:00
|
|
|
dict(CHAMP_LOCAL, **CHAMPS_POI, **CHAMPS_ADRESSE),
|
2021-10-03 18:10:19 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2021-10-10 16:53:12 +02:00
|
|
|
CHAMP_LOCAL = {"amenity": {"export_json": "Non", "FR": ""}}
|
|
|
|
REQS.append(
|
|
|
|
Requete(
|
2021-10-03 18:10:19 +02:00
|
|
|
"velos_libre_service",
|
|
|
|
r'nwr["amenity"="bicycle_rental"](area:aire_de_recherche);',
|
2021-10-10 16:53:12 +02:00
|
|
|
dict(CHAMP_LOCAL, **CHAMPS_POI, **CHAMPS_ADRESSE),
|
2021-10-03 18:10:19 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2021-10-10 16:53:12 +02:00
|
|
|
CHAMP_LOCAL = {"service:bicycle:rental": {"export_json": "Non", "FR": ""}}
|
|
|
|
REQS.append(
|
|
|
|
Requete(
|
2021-10-03 18:10:19 +02:00
|
|
|
"location_velo",
|
|
|
|
r'nwr["service:bicycle:rental"="yes"](area:aire_de_recherche);',
|
2021-10-10 16:53:12 +02:00
|
|
|
dict(CHAMP_LOCAL, **CHAMPS_POI, **CHAMPS_ADRESSE),
|
2021-10-03 18:10:19 +02:00
|
|
|
)
|
|
|
|
)
|