Commit 08324fd8 authored by Adrien Pavie's avatar Adrien Pavie
Browse files

Add official schema names in themes, added fire equip and addresses themes

parent 4f7999f6
......@@ -153,6 +153,7 @@ Des balises optionnelles peuvent également être prévues :
* `<ADM8NAME>` : nom de la commune
* `<ADM8REF>` : code INSEE de la commune
* `<GEOMEMBED>` : la géométrie initiale (EPSG:3857), pour utilisation dans des fonctions type `ST_X / ST_Y` ou `ST_Transform`
* `<OSMID>` : l'identifiant de l'objet d'origine dans OpenStreetMap (exemple : `way/1234`)
## Base de données
......
......@@ -128,9 +128,9 @@ function getMetadataText(theme, boundary, format, url) {
"",
"Infracommunale",
boundary.name,
"",
isoToday(),
"2008-01-01",
isoToday(),
"",
"Ponctuelle",
isoToday(),
`"scdl;${toSlug(theme["theme:fr"])}${theme["keywords:fr"] ? ";" + theme["keywords:fr"].map(t => toSlug(t)).join(";") : ""}"`,
......@@ -180,6 +180,7 @@ function getThemeData(theme, boundary, options) {
.replace(/<GEOMEMBED>/g, "t.way")
.replace(/<ADM8NAME>/g, "b2.name")
.replace(/<ADM8REF>/g, "b2.ref")
.replace(/<OSMID>/g, g === "point" ? "CONCAT('node/', t.osm_id)" : "CASE WHEN t.osm_id > 0 THEN CONCAT('way/', t.osm_id) ELSE CONCAT('relation/', -t.osm_id) END")
.replace(/SELECT\s+,/g, "SELECT ")
.replace(/,\s+FROM/g, " FROM")
)).join(" UNION ");
......
......@@ -80,7 +80,7 @@
<div class="form-check mb-3">
<input class="form-check-input" type="checkbox" id="metadata" checked />
<label class="form-check-label" for="metadata">
Inclure une fiche de métadonnées
Ajouter les métadonnées (<a href="https://schema.data.gouv.fr/scdl/catalogue/0.1.2.html">schéma Catalogue simplifié 0.1.2</a>)
</label>
</div>
......@@ -109,7 +109,7 @@
<div class="media">
<img src="img/geodatamine.svg" class="align-self-center mr-3" height="128" alt="" />
<div class="media-body align-self-center">
<p class="mb-0">GéoDataMine facilite l'extraction de données thématiques depuis OpenStreetMap, sous la forme de fichiers tableurs ou géographiques. <a href="https://www.openstreetmap.org/">OpenStreetMap</a> est une base de données géographique collaborative, l'équivalent de Wikipédia pour la cartographie. On y trouve toutes sortes d'informations : routes, bâtiments, commerces, services publics... Il est simple de participer, mais pas si facile de télécharger des données d'une thématique spécifique sur son territoire. D'où cet assistant très simple ! Les données sont actualisées quotidiennement, et rendues disponibles aux formats CSV, GeoJSON et Shapefile.</p>
<p class="mb-0">GéoDataMine facilite l'extraction de données thématiques depuis OpenStreetMap, sous la forme de fichiers tableurs ou géographiques. <a href="https://www.openstreetmap.org/">OpenStreetMap</a> est une base de données géographique collaborative, l'équivalent de Wikipédia pour la cartographie. On y trouve toutes sortes d'informations : routes, bâtiments, commerces, services publics... Il est simple de participer, mais pas si facile de télécharger des données d'une thématique spécifique sur son territoire. D'où cet assistant très simple ! Les données sont actualisées quotidiennement, et rendues disponibles aux formats CSV, GeoJSON et Shapefile. Elles sont rendues compatibles avec les <a href="https://schema.data.gouv.fr/">schémas de données nationaux</a> lorsqu'ils existent, sinon selon les <a href="https://wiki.openstreetmap.org/wiki/FR:%C3%89l%C3%A9ments_cartographiques">conventions d'OpenStreetMap</a>.</p>
</div>
</div>
......
--METADATA={ "name:fr": "Adresses (schéma Étalab Base adresse locale 1.1.4)", "name:en": "Addresses", "theme:fr": "Infrastructures", "keywords:fr": [ "adresses", "bal", "adresse postale", "numéro de rue" ], "description:fr": "Adresses issues d'OpenStreetMap (addr:housenumber=*)", "skipGeomCSV": true }
--GEOMETRY=point,polygon
SELECT
concat(
<ADM8REF>,
'_xxxx_',
lpad(substring("addr:housenumber" from '^\d+'), 5, '0'),
CASE WHEN lower(trim(both ' ' from replace(regexp_replace("addr:housenumber", '^\d+', ''), ' ', ''))) != '' THEN concat('_', lower(trim(both ' ' from replace(regexp_replace("addr:housenumber", '^\d+', ''), ' ', '')))) ELSE null END
) AS cle_interop,
'' AS uid_adresse,
COALESCE(t.tags->'addr:street', t.tags->'addr:hamlet') AS voie_nom,
substring("addr:housenumber" from '^\d+') AS numero,
lower(trim(both ' ' from replace(regexp_replace("addr:housenumber", '^\d+', ''), ' ', ''))) AS suffixe,
<ADM8NAME> AS commune_nom,
CASE
WHEN t.tags->'entrance' IS NOT NULL THEN 'entrée'
WHEN t.tags->'building' IS NOT NULL THEN 'bâtiment'
ELSE 'délivrance postale'
END AS position,
ST_X(ST_Transform(ST_Centroid(<GEOMEMBED>), 2154)) AS x,
ST_Y(ST_Transform(ST_Centroid(<GEOMEMBED>), 2154)) AS y,
ST_X(ST_Transform(ST_Centroid(<GEOMEMBED>), 4326)) AS "long",
ST_Y(ST_Transform(ST_Centroid(<GEOMEMBED>), 4326)) AS lat,
COALESCE(t.tags->'source:addr', 'OpenStreetMap') AS source,
substring(tags->'osm_timestamp', 1, 10) AS date_der_maj
FROM <TABLE>
WHERE <GEOMCOND> AND t."addr:housenumber" ~ '^\d+([a-zA-Z ]+)?$'
--METADATA={ "name:fr": "Défibrillateur", "name:en": "Automated external defibrillator", "theme:fr": "Santé", "keywords:fr": [ "défibrilateur", "aed", "dae" ], "description:fr": "Défibrillateurs extraits d'OpenStreetMap (emergency=defibrillator) au format de la base de données nationale des DAE", "skipGeomCSV": true }
--METADATA={ "name:fr": "Défibrillateur (schéma base nationale DAE)", "name:en": "Automated external defibrillator", "theme:fr": "Santé", "keywords:fr": [ "défibrilateur", "aed", "dae" ], "description:fr": "Défibrillateurs extraits d'OpenStreetMap (emergency=defibrillator) au format de la base de données nationale des DAE", "skipGeomCSV": true }
--GEOMETRY=point
SELECT
......@@ -23,7 +23,7 @@ SELECT
WHEN t.tags->'mapillary' IS NOT NULL THEN concat('https://images.mapillary.com/', t.tags->'mapillary', '/thumb-2048.jpg')
END AS photo1,
t.tags->'start_date' AS date_instal,
concat('node/', t.osm_id) AS gid,
<OSMID> AS gid,
ST_X(ST_Transform(<GEOMEMBED>, 4326)) AS x_coor2,
ST_Y(ST_Transform(<GEOMEMBED>, 4326)) AS y_coor2,
7 AS xy_precis,
......
......@@ -2,8 +2,8 @@
--GEOMETRY=point,polygon
SELECT
t.osm_id, t.tags->'name' AS name, t.tags->'operator' AS operator, t.tags->'plots' AS nb_parcelles,
<OSMID> as osm_id, t.tags->'name' AS name, t.tags->'operator' AS operator, t.tags->'plots' AS nb_parcelles,
t.tags->'user' AS utilisateur,
<GEOM>
<ADM8REF> AS com_insee, <ADM8NAME> AS com_nom, <GEOM>
FROM <TABLE>
WHERE <GEOMCOND> AND t.landuse = 'allotments'
......@@ -2,11 +2,11 @@
--GEOMETRY=point,polygon
SELECT
t.osm_id, t.amenity AS type, t.tags->'name' AS name, t.tags->'brand' AS brand,
<OSMID> as osm_id, t.amenity AS type, t.tags->'name' AS name, t.tags->'brand' AS brand,
t.tags->'operator' AS operator, t.tags->'network' AS network, t.wheelchair,
t.tags->'opening_hours' AS opening_hours, t.tags->'bic' AS bank_id_code,
CASE WHEN t.amenity = 'atm' THEN 'yes' ELSE t.tags->'atm' END AS has_atm,
t.tags->'brand:wikidata' AS brand_wikidata,
<GEOM>
<ADM8REF> AS com_insee, <ADM8NAME> AS com_nom, <GEOM>
FROM <TABLE>
WHERE <GEOMCOND> AND t.amenity IN ('bank', 'atm')
......@@ -2,8 +2,9 @@
--GEOMETRY=point,polygon
SELECT
t.osm_id, t.tags->'name' AS name, t.access, t.tags->'operator' AS operator,
<OSMID> as osm_id, t.tags->'name' AS name, t.access, t.tags->'operator' AS operator,
t.tags->'covered' AS covered, t.tags->'capacity' AS capacity,
t.tags->'bicycle_parking' AS type, <GEOM>
t.tags->'bicycle_parking' AS type,
<ADM8REF> AS com_insee, <ADM8NAME> AS com_nom, <GEOM>
FROM <TABLE>
WHERE <GEOMCOND> AND t.amenity = 'bicycle_parking'
--METADATA={ "name:fr": "Lieu de covoiturage", "name:en": "Carpool station", "theme:fr": "Transports", "keywords:fr": [ "covoiturage" ], "description:fr": "Lieux de covoiturage issus d'OpenStreetMap (amenity=parking + carpool=yes|designated ou amenity=car_pooling) au format Schéma Lieux covoiturage", "skipGeomCSV": true }
--METADATA={ "name:fr": "Covoiturage (schéma Étalab Lieux de covoiturage 0.1.2)", "name:en": "Carpool station", "theme:fr": "Transports", "keywords:fr": [ "covoiturage" ], "description:fr": "Lieux de covoiturage issus d'OpenStreetMap (amenity=parking + carpool=yes|designated ou amenity=car_pooling) au format Schéma Lieux covoiturage", "skipGeomCSV": true }
--GEOMETRY=point,polygon
SELECT
t.tags->'ref:FR:BNCLC' AS id_lieu,
COALESCE(t.tags->'ref:FR:BNCLC', <OSMID>) AS id_lieu,
t.tags->'name' AS nom_lieu,
CASE WHEN t.tags->'addr:housenumber' IS NOT NULL AND t.tags->'addr:street' IS NOT NULL THEN concat(t.tags->'addr:housenumber', ' ', t.tags->'addr:street') END AS ad_lieu,
<ADM8NAME> AS com_lieu,
......
......@@ -2,8 +2,8 @@
--GEOMETRY=polygon
SELECT
t.osm_id, t.tags->'name' AS name, t.tags->'religion' AS religion, t.tags->'denomination' AS religion_denomination,
<OSMID> as osm_id, t.tags->'name' AS name, t.tags->'religion' AS religion, t.tags->'denomination' AS religion_denomination,
t.tags->'operator' AS operator, t.wheelchair, t.tags->'opening_hours' AS opening_hours,
<ADM8NAME> AS commune_name, <ADM8REF> AS code_insee, <GEOM>
<ADM8REF> AS com_insee, <ADM8NAME> AS com_nom, <GEOM>
FROM <TABLE>
WHERE <GEOMCOND> AND t.landuse = 'cemetery'
--METADATA={ "name:fr": "Borne de recharge de véhicule électrique (IRVE)", "name:en": "Vehicle charging station", "theme:fr": "Transports", "keywords:fr": [ "irve", "borne de recharge électrique" ], "description:fr": "Bornes de recharge de véhicule électrique issues d'OpenStreetMap (amenity=charging_station) au format Schéma IRVE", "skipGeomCSV": true }
--METADATA={ "name:fr": "Recharge de véhicule électrique (schéma Étalab IRVE 1.0.2)", "name:en": "Vehicle charging station", "theme:fr": "Transports", "keywords:fr": [ "irve", "borne de recharge électrique" ], "description:fr": "Bornes de recharge de véhicule électrique issues d'OpenStreetMap (amenity=charging_station) au format Schéma IRVE", "skipGeomCSV": true }
--GEOMETRY=point,polygon
SELECT
t.tags->'owner' AS n_amenageur,
t.tags->'operator' AS n_operateur,
COALESCE(t.tags->'network', t.tags->'brand') AS n_enseigne,
t.tags->'ref' AS id_station,
COALESCE(t.tags->'ref', <OSMID>) AS id_station,
t.tags->'name' AS n_station,
CASE
WHEN t.tags->'addr:housenumber' IS NOT NULL AND t.tags->'addr:street' IS NOT NULL THEN concat(t.tags->'addr:housenumber', ' ', t.tags->'addr:street', ', ', <ADM8NAME>)
......
......@@ -2,8 +2,8 @@
--GEOMETRY=line
SELECT
t.osm_id, t.cycleway, t.highway, t."cycleway:right", t."cycleway:left", t."cycleway:both", t.tags->'name' AS name,
<OSMID> as osm_id, t.cycleway, t.highway, t."cycleway:right", t."cycleway:left", t."cycleway:both", t.tags->'name' AS name,
t.tags->'surface' AS surface, t.tags->'oneway' AS oneway, t.tags->'bridge' AS bridge, t.tags->'tunnel' AS tunnel,
<GEOM>
<ADM8REF> AS com_insee, <ADM8NAME> AS com_nom, <GEOM>
FROM <TABLE>
WHERE <GEOMCOND> AND (t.cycleway IS NOT NULL OR t.highway = 'cycleway' OR t."cycleway:right" IS NOT NULL OR t."cycleway:left" IS NOT NULL OR t."cycleway:both" IS NOT NULL)
......@@ -2,8 +2,8 @@
--GEOMETRY=point,polygon
SELECT
t.osm_id, t.tags->'name' AS name, t.tags->'amenity' AS type, t.tags->'school:FR' AS type_fr,
<OSMID> as osm_id, t.tags->'name' AS name, t.tags->'amenity' AS type, t.tags->'school:FR' AS type_fr,
t.tags->'operator:type' AS statut, t.tags->'ref:UAI' AS ref_uai, t.tags->'wikidata' AS wikidata,
<ADM8NAME> AS commune_name, <ADM8REF> AS code_insee, <GEOM>
<ADM8REF> AS com_insee, <ADM8NAME> AS com_nom, <GEOM>
FROM <TABLE>
WHERE <GEOMCOND> AND t.amenity IN ('school', 'kindergarten', 'college', 'university')
--METADATA={ "name:fr": "Équipement de lutte contre les incendies", "name:en": "Anti-fire devices", "theme:fr": "Sécurité", "keywords:fr": [ "incendie", "borne", "poteau", "colonne sèche", "hydrant" ], "description:fr": "Équipements permettant de lutter contre les incendies issus d'OpenStreetMap (emergency=dry_riser_inlet|fire_extinguisher|fire_flapper|fire_hose|fire_hydrant|water_tank|fire_water_pond|suction_point)" }
--GEOMETRY=point,polygon
SELECT
<OSMID> as osm_id, t.emergency AS type, t.tags->'ref' AS "ref",
t.tags->'fire_hydrant:type' AS fire_hydrant_type, t.tags->'fire_hydrant:pressure' AS pressure,
t.tags->'fire_hydrant:diameter' AS diameter, t.tags->'colour' AS colour, t.tags->'flow_rate' AS flow_rate,
t.tags->'couplings' AS couplings, t.tags->'water_source' AS water_source, t.tags->'survey:date' AS survey_date,
t.tags->'fire_hydrant:position' AS position, t.tags->'water_tank:volume' AS volume,
t.tags->'indoor' AS indoor, t.tags->'level' AS level,
<ADM8REF> AS com_insee, <ADM8NAME> AS com_nom, <GEOM>
FROM <TABLE>
WHERE <GEOMCOND> AND t.emergency IN ('dry_riser_inlet', 'fire_extinguisher', 'fire_flapper', 'fire_hose', 'fire_hydrant', 'water_tank', 'fire_water_pond', 'suction_point')
......@@ -2,10 +2,10 @@
--GEOMETRY=point,polygon
SELECT
t.osm_id, t.tags->'name' AS name, t.tags->'brand' AS brand,
<OSMID> as osm_id, t.tags->'name' AS name, t.tags->'brand' AS brand,
t.tags->'operator' AS operator, t.tags->'opening_hours' AS opening_hours,
t.tags->'fuel:diesel' AS fuel_diesel, t.tags->'fuel:octane_95' AS fuel_95, t.tags->'fuel:octane_98' AS fuel_98,
t.tags->'fuel:e10' AS fuel_e10, t.tags->'fuel:lpg' AS fuel_gpl,
<GEOM>
<ADM8REF> AS com_insee, <ADM8NAME> AS com_nom, <GEOM>
FROM <TABLE>
WHERE <GEOMCOND> AND t.amenity = 'fuel'
......@@ -2,10 +2,10 @@
--GEOMETRY=point,polygon
SELECT
t.osm_id, t.amenity AS type, t.tags->'name' AS name,
<OSMID> as osm_id, t.amenity AS type, t.tags->'name' AS name,
t.tags->'operator' AS operator, t.tags->'emergency' AS emergency, t.wheelchair,
t.tags->'opening_hours' AS opening_hours, t.tags->'ref:FR:FINESS' AS ref_finess,
t.tags->'type:FR:FINESS' AS type_finess, t.tags->'ref:FR:NAF' AS ref_naf, t.tags->'capacity' AS capacity,
<GEOM>
<ADM8REF> AS com_insee, <ADM8NAME> AS com_nom, <GEOM>
FROM <TABLE>
WHERE <GEOMCOND> AND t.amenity IN ('hospital', 'clinic', 'dentist', 'doctors', 'nursing_home', 'pharmacy')
......@@ -2,10 +2,10 @@
--GEOMETRY=point,polygon
SELECT
t.osm_id, COALESCE(t.historic, t.amenity) AS type, t.tags->'name' AS name, t.tags->'ref:mhs' AS ref_mhs,
<OSMID> as osm_id, COALESCE(t.historic, t.amenity) AS type, t.tags->'name' AS name, t.tags->'ref:mhs' AS ref_mhs,
t.tags->'religion' AS religion, t.tags->'denomination' AS religion_denomination,
t.tags->'inscription' AS inscription, t.tags->'start_date' AS build_date, t.tags->'description' AS description,
t.tags->'wikipedia' AS wikipedia, t.tags->'historic:civilization' AS civilization, t.tags->'heritage' AS heritage,
<GEOM>
<ADM8REF> AS com_insee, <ADM8NAME> AS com_nom, <GEOM>
FROM <TABLE>
WHERE <GEOMCOND> AND (t.amenity IN ('fountain', 'place_of_worship', 'lavoir') OR t.historic IS NOT NULL)
......@@ -2,11 +2,11 @@
--GEOMETRY=point,polygon
SELECT
t.osm_id, t.tourism AS type, t.tags->'name' AS name,
<OSMID> as osm_id, t.tourism AS type, t.tags->'name' AS name,
t.tags->'operator' AS operator, t.wheelchair, t.tags->'opening_hours' AS opening_hours,
t.tags->'opening_hours:reception' AS reception_opening_hours, t.tags->'stars' AS stars,
t.tags->'rooms' AS rooms, t.tags->'beds' AS beds, t.internet_access, t.tags->'camp_site' AS camp_site,
t.tags->'fee' AS fee, t.tags->'capacity' AS capacity,
<GEOM>
<ADM8REF> AS com_insee, <ADM8NAME> AS com_nom, <GEOM>
FROM <TABLE>
WHERE <GEOMCOND> AND t.tourism IN ('hotel', 'chalet', 'guest_house', 'apartment', 'hostel', 'motel', 'wilderness_hut', 'alpine_hut', 'camp_site', 'caravan_site')
......@@ -2,10 +2,11 @@
--GEOMETRY=point,polygon
SELECT
t.osm_id, t.internet_access AS connexion_type, t.tags->'internet_access:fee' AS fee,
<OSMID> as osm_id, t.internet_access AS connexion_type, t.tags->'internet_access:fee' AS fee,
COALESCE(t.tags->'internet_access:description', t.tags->'description') AS description,
t.tags->'internet_access:operator' AS internet_operator, t.tags->'internet_access:ssid' AS ssid,
t.tags->'name' AS place_name, t.access AS place_access, t.tags->'opening_hours' AS place_opening_hours,
COALESCE(t.amenity, t.shop, t.tourism, t.office, 'unknown') AS place_type, <GEOM>
COALESCE(t.amenity, t.shop, t.tourism, t.office, 'unknown') AS place_type,
<ADM8REF> AS com_insee, <ADM8NAME> AS com_nom, <GEOM>
FROM <TABLE>
WHERE <GEOMCOND> AND internet_access IS NOT NULL AND internet_access != 'no'
......@@ -2,8 +2,8 @@
--GEOMETRY=point,polygon
SELECT
t.osm_id, t.amenity AS type, t.tags->'name' AS name, t.tags->'ref:isil' AS ref_isil,
<OSMID> as osm_id, t.amenity AS type, t.tags->'name' AS name, t.tags->'ref:isil' AS ref_isil,
t.tags->'operator' AS operator, t.wheelchair, t.tags->'opening_hours' AS opening_hours,
<ADM8NAME> AS commune_name, <ADM8REF> AS code_insee, <GEOM>
<ADM8REF> AS com_insee, <ADM8NAME> AS com_nom, <GEOM>
FROM <TABLE>
WHERE <GEOMCOND> AND t.amenity IN ('library', 'public_bookcase')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment