Commit b59ab004 authored by Adrien Pavie's avatar Adrien Pavie
Browse files

Updated cycleways and shop themes, using latest osm2pgsql

parent 584ccb88
......@@ -7,10 +7,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## Next version (to be released)
## 0.2.4 - 2020-12-17
### Changed
- Updated theme for AED (using new tags after release of GeoDAE database)
- Updated theme for recycling (now wider waste management with `amenity=waste_disposal` features)
- Updated theme for healthcare (includes nursing homes when under `amenity=social_facility` tag)
- Updated theme for cycleways (using Etalab data scheme)
- Updated theme for shop/craft/office (uses `contact:*` OSM tags, link to _Ça reste ouvert_ website)
## 0.2.3 - 2020-07-09
......
......@@ -15,7 +15,7 @@ Les dépendances sont les suivantes :
* NodeJS >= 9
* PostgreSQL >= 9.6 et ses extensions PostGIS, HStore, PG_TRGM, Unaccent
* wget
* [osm2pgsql](https://github.com/openstreetmap/osm2pgsql) (versions plus récentes que le 28 février 2020)
* [osm2pgsql](https://github.com/openstreetmap/osm2pgsql) >= 1.4.0
* [jq](https://stedolan.github.io/jq/)
* GDAL >= 2.1 (et en particulier la commande `ogr2ogr`)
* zip et zipnote
......
......@@ -36,6 +36,7 @@ local generic_keys = {
'cycleway:both',
'cycleway:left',
'cycleway:right',
'bicycle',
'addr:housenumber',
'internet_access',
'carpool',
......@@ -46,7 +47,7 @@ local generic_keys = {
}
-- The following keys will be deleted
local delete_tags = { 'FIXME', 'note', 'source', 'way', 'way_area', 'z_order', }
local delete_tags = { 'FIXME', 'way', 'way_area', 'z_order', }
-- Array used to specify z_order per key/value combination.
-- Each element has the form {key, value, z_order, is_road}.
......@@ -109,6 +110,7 @@ tables.line = osm2pgsql.define_table{
{ column = 'cycleway:both', type = 'text' },
{ column = 'cycleway:left', type = 'text' },
{ column = 'cycleway:right', type = 'text' },
{ column = 'bicycle', type = 'text' },
{ column = 'tags', type = 'hstore' },
{ column = 'rel_tags', type = 'hstore' },
{ column = 'way', type = 'linestring' }
......@@ -196,6 +198,10 @@ function to_row(object)
return row
end
function osm2pgsql.select_relation_members(relation)
return { ways = osm2pgsql.way_member_ids(relation) }
end
function osm2pgsql.process_node(object)
if is_empty(object.tags) then
return
......@@ -228,12 +234,6 @@ function osm2pgsql.process_way(object)
return
end
-- Ways are processed in stage 2 to retrieve relation tags
if osm2pgsql.stage == 1 then
osm2pgsql.mark_way(object.id)
return
end
-- Stage 2
local row = to_row(object)
local polygon = is_polygon(object.tags)
......@@ -247,10 +247,12 @@ function osm2pgsql.process_way(object)
polygon = false
end
-- If there is any data from relations, add it in
local d = by_way_id[object.id]
if d then
row.rel_tags = d
-- If there is any data from relations, add it in (only in stage 2)
if osm2pgsql.stage == 2 then
local d = by_way_id[object.id]
if d then
row.rel_tags = d
end
end
if polygon then
......
--METADATA={ "name:fr": "Piste/bande cyclable", "name:en": "Cycleway", "theme:fr": "Transports", "keywords:fr": [ "piste cyclable", "bande cyclable" ], "description:fr": "Pistes et bandes cyclables issues d'OpenStreetMap (cycleway=* ou cycleway:right=* ou cycleway:left=* ou cycleway:both=* ou highway=cycleway)" }
--METADATA={ "name:fr": "Aménagements cyclables (schéma Étalab Aménagements cyclables 0.2.0)", "name:en": "Cycleway", "theme:fr": "Transports", "keywords:fr": [ "piste cyclable", "bande cyclable", "aménagement cyclable" ], "description:fr": "Aménagement cyclables issues d'OpenStreetMap (cycleway=* ou cycleway:right=* ou cycleway:left=* ou cycleway:both=* ou highway=cycleway)" }
--GEOMETRY=line
SELECT
<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,
<ADM8REF> AS com_insee, <ADM8NAME> AS com_nom, <GEOM>
t.tags->'ref' AS id_local,
'' AS reseau_loc,
array_to_string(array_remove(ARRAY[t.rel_tags->'route_icn_ref', t.rel_tags->'route_ncn_ref', t.rel_tags->'route_rcn_ref', t.rel_tags->'route_lcn_ref'], NULL), ' - ') AS nom_loc,
<ADM8REF> AS code_com,
<OSMID> AS id_osm,
array_to_string(array_remove(ARRAY[t.rel_tags->'route_icn_ref', t.rel_tags->'route_ncn_ref', t.rel_tags->'route_rcn_ref', t.rel_tags->'route_lcn_ref'], NULL), ':') AS num_iti,
CASE
WHEN t.highway IS NOT NULL AND t.highway != 'cycleway' AND t.cycleway = 'lane' AND t.tags->'lanes' = '1' AND t.tags->'oneway' = 'no' THEN 'CHAUSSEE A VOIE CENTRALE BANALISEE'
WHEN t.highway = 'path' AND (t.tags->'motor_vehicle' IS NULL OR t.tags->'motor_vehicle' = 'no') AND t.bicycle IN ('yes', 'designated') THEN 'VOIE VERTE'
WHEN (t.highway = 'cycleway' AND t.tags->'foot' = 'designated' AND t.tags->'segregated' = 'yes') OR (t.highway IS NOT NULL AND t.highway != 'cycleway' AND (t.cycleway = 'track' OR t."cycleway:right" = 'track' OR t."cycleway:both" = 'track') AND t.tags->'segregated' = 'yes') OR (t.highway = 'cycleway' AND t.tags->'oneway' = 'yes' AND t.tags->'foot' = 'designated' AND t.tags->'segregated' = 'yes') OR t.tags->'sidewalk:bicycle' = 'yes' OR (t.highway = 'footway' AND t.tags->'footway' = 'sidewalk' AND t.bicycle IN ('yes', 'designated') AND t.tags->'oneway' = 'yes') THEN 'AMENAGEMENT MIXTES PIETON VELO HORS VOIE VERTE'
WHEN t.tags->'cyclestreet' = 'yes' THEN 'VELO RUE'
WHEN t.tags->'ramp:bicycle' = 'yes' THEN 'RAMPE'
WHEN t.highway IS NOT NULL AND t.highway != 'cycleway' AND (t.cycleway = 'track' OR t."cycleway:right" = 'track' OR t."cycleway:both" = 'track') AND t.tags->'oneway' = 'yes' AND t.tags->'oneway:bicycle' = 'no' THEN 'DOUBLE SENS CYCLABLE PISTE'
WHEN t.highway IS NOT NULL AND t.highway != 'cycleway' AND (t.cycleway = 'lane' OR t."cycleway:right" = 'lane' OR t."cycleway:both" = 'lane') AND t.tags->'oneway' = 'yes' AND t.tags->'oneway:bicycle' = 'no' THEN 'DOUBLE SENS CYCLABLE BANDE'
WHEN t.highway IS NOT NULL AND t.highway != 'cycleway' AND (t.tags->'oneway:bicycle' = 'no' OR t.cycleway = 'opposite' OR t."cycleway:right" = 'opposite') AND t.tags->'oneway' = 'yes' THEN 'DOUBLE SENS CYCLABLE'
WHEN t.cycleway = 'track' OR t."cycleway:right" = 'track' OR t.highway = 'cycleway' THEN 'PISTE CYCLABLE'
WHEN t.cycleway = 'lane' OR t."cycleway:right" = 'lane' OR t."cycleway:both" = 'lane' THEN 'BANDE CYCLABLE'
WHEN t.cycleway = 'share_busway' OR t."cycleway:right" = 'share_busway' OR t."cycleway:both" = 'share_busway' OR (t.highway='service' AND t.tags->'access' = 'no' AND t.tags->'psv' IN ('yes', 'designated') AND t.bicycle IN ('yes', 'designated')) THEN 'COULOIR BUS+VELO'
END AS ame_d,
CASE
WHEN t.tags->'maxspeed' = '30' AND (t.tags->'zone:maxspeed' = 'FR:30' OR t.tags->'source:maxspeed' = 'FR:zone30') THEN 'ZONE 30'
WHEN t.highway IN ('footway', 'pedestrian') THEN 'AIRE PIETONNE'
WHEN t.highway = 'living_street' OR t.tags->'living_street' = 'yes' THEN 'ZONE DE RENCONTRE'
END AS regime_d,
CASE
WHEN (t.highway = 'cycleway' AND t.tags->'oneway' = 'no') OR (t."cycleway:right" IN ('lane', 'track') AND t.tags->'cycleway:right:oneway' = 'no') THEN 'BIDIRECTIONNEL'
ELSE 'UNIDIRECTIONNEL'
END AS sens_d,
COALESCE(t.tags->'cycleway:right:width', t.tags->'cycleway:right:est_width', t.tags->'cycleway:both:width', t.tags->'cycleway:both:est_width', t.tags->'cycleway:width', t.tags->'cycleway:est_width') AS largeur_d,
CASE
WHEN t.highway IS NOT NULL AND t.highway != 'cycleway' AND t.cycleway = 'lane' AND t.tags->'lanes' = '1' AND t.tags->'oneway' = 'no' THEN 'CHAUSSEE A VOIE CENTRALE BANALISEE'
WHEN t.highway = 'path' AND (t.tags->'motor_vehicle' IS NULL OR t.tags->'motor_vehicle' = 'no') AND t.bicycle = 'designated' THEN 'VOIE VERTE'
WHEN (t.highway IS NOT NULL AND t.highway != 'cycleway' AND (t.cycleway = 'track' OR t."cycleway:left" = 'track' OR t."cycleway:both" = 'track') AND t.tags->'segregated' = 'yes') OR t.tags->'sidewalk:bicycle' = 'yes' OR (t.highway = 'footway' AND t.tags->'footway' = 'sidewalk' AND t.bicycle IN ('yes', 'designated') AND t.tags->'oneway' = 'yes') THEN 'AMENAGEMENT MIXTES PIETON VELO HORS VOIE VERTE'
WHEN t.tags->'cyclestreet' = 'yes' AND (t.tags->'oneway' = 'no' OR t.tags->'oneway' IS NULL) THEN 'VELO RUE'
WHEN t.tags->'ramp:bicycle' = 'yes' THEN 'RAMPE'
WHEN t.highway IS NOT NULL AND t.highway != 'cycleway' AND (t.cycleway = 'track' OR t."cycleway:left" = 'track' OR t."cycleway:both" = 'track') AND t.tags->'oneway' = 'yes' AND t.tags->'oneway:bicycle' = 'no' THEN 'DOUBLE SENS CYCLABLE PISTE'
WHEN t.highway IS NOT NULL AND t.highway != 'cycleway' AND (t.cycleway = 'lane' OR t."cycleway:left" = 'lane' OR t."cycleway:both" = 'lane') AND t.tags->'oneway' = 'yes' AND t.tags->'oneway:bicycle' = 'no' THEN 'DOUBLE SENS CYCLABLE BANDE'
WHEN t.highway IS NOT NULL AND t.highway != 'cycleway' AND (t.tags->'oneway:bicycle' = 'no' OR t.cycleway = 'opposite' OR t."cycleway:left" = 'opposite') AND t.tags->'oneway' = 'yes' THEN 'DOUBLE SENS CYCLABLE'
WHEN t.cycleway = 'track' OR t."cycleway:left" = 'track' OR t.highway = 'cycleway' THEN 'PISTE CYCLABLE'
WHEN t.cycleway = 'lane' OR t."cycleway:left" = 'lane' OR t."cycleway:both" = 'lane' THEN 'BANDE CYCLABLE'
WHEN t."cycleway:left" = 'share_busway' OR ((t.tags->'oneway' = 'no' OR t.tags->'oneway' IS NULL) AND (t.cycleway = 'share_busway' OR t."cycleway:both" = 'share_busway')) OR ((t.tags->'oneway' = 'no' OR t.tags->'oneway' IS NULL) AND t.highway='service' AND t.tags->'access' = 'no' AND t.tags->'psv' IN ('yes', 'designated') AND t.bicycle IN ('yes', 'designated')) THEN 'COULOIR BUS+VELO'
END AS ame_g,
CASE
WHEN t.tags->'maxspeed' = '30' AND (t.tags->'zone:maxspeed' = 'FR:30' OR t.tags->'source:maxspeed' = 'FR:zone30') THEN 'ZONE 30'
WHEN t.highway IN ('footway', 'pedestrian') THEN 'AIRE PIETONNE'
WHEN t.highway = 'living_street' OR t.tags->'living_street' = 'yes' THEN 'ZONE DE RENCONTRE'
END AS regime_g,
CASE
WHEN (t.highway = 'cycleway' AND t.tags->'oneway' = 'no') OR (t."cycleway:left" IN ('lane', 'track') AND t.tags->'cycleway:left:oneway' = 'no') THEN 'BIDIRECTIONNEL'
ELSE 'UNIDIRECTIONNEL'
END AS sens_g,
COALESCE(t.tags->'cycleway:left:width', t.tags->'cycleway:left:est_width', t.tags->'cycleway:both:width', t.tags->'cycleway:both:est_width', t.tags->'cycleway:width', t.tags->'cycleway:est_width') AS largeur_g,
CASE
WHEN t.highway = 'footway' OR t.tags->'sidewalk:bicycle' = 'yes' OR (t.highway IS NOT NULL AND t.highway != 'cycleway' AND t.tags->'segregated' = 'yes') THEN 'TROTTOIR'
ELSE 'CHAUSSEE'
END AS local_ame,
CASE
WHEN t.highway='construction' OR t.tags->'construction' IS NOT NULL THEN 'EN TRAVAUX'
ELSE 'EN SERVICE'
END AS statut_ame,
CASE
WHEN t.tags->'smoothness' IN ('excellent', 'good') THEN 'ROLLER'
WHEN t.tags->'smoothness' = 'intermediate' THEN 'VELO DE ROUTE'
WHEN t.tags->'smoothness' = 'bad' THEN 'VTC'
WHEN t.tags->'smoothness' IN ('very_bad', 'horrible', 'very_horrible') THEN 'VTT'
END access_ame,
substring(t.tags->'osm_timestamp', 1, 10) AS date_maj,
t.tags->'maxspeed' AS trafic_vit,
CASE
WHEN t.tags->'lit' = 'yes' THEN TRUE
WHEN t.tags->'lit' = 'no' THEN FALSE
END AS lumiere,
CASE
WHEN t.tags->'start_date' IS NOT NULL THEN substring(t.tags->'start_date', 1, 4)
END AS d_service,
COALESCE(t.tags->'description', t.tags->'note', t.tags->'fixme') AS comm,
COALESCE(t.tags->'source', 'OpenStreetMap') AS source,
'WGS84' AS project_c,
'' AS ref_geo,
<GEOM>
FROM <TABLE>
WHERE (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) AND <GEOMCOND>
WHERE ((t.cycleway IS NOT NULL AND t.cycleway != 'no') OR t.highway = 'cycleway' OR (t."cycleway:right" IS NOT NULL AND t."cycleway:right" != 'no') OR (t."cycleway:left" IS NOT NULL AND t."cycleway:left" != 'no') OR (t."cycleway:both" IS NOT NULL AND t."cycleway:both" != 'no') OR t.bicycle IN ('yes', 'designated')) AND <GEOMCOND>
......@@ -5,8 +5,13 @@ SELECT
<OSMID> as osm_id, COALESCE(t.office, t.craft, t.shop) AS type, t.tags->'name' AS name,
t.tags->'brand' AS brand, t.tags->'operator' AS operator, t.wheelchair,
t.tags->'opening_hours' AS opening_hours, t.tags->'level' AS level, t.tags->'ref:FR:SIRET' AS siret,
t.tags->'wikidata' AS wikidata, t.tags->'brand:wikidata' AS brand_wikidata,
COALESCE(t.tags->'website', t.tags->'brand:website') AS website, t.tags->'phone' AS phone, t.tags->'email' AS email, t.tags->'facebook' AS facebook,
<ADM8REF> AS com_insee, <ADM8NAME> AS com_nom, <GEOM>
COALESCE(t.tags->'wikidata', t.tags->'brand:wikidata') AS wikidata,
COALESCE(t.tags->'website', t.tags->'contact:website', t.tags->'brand:website') AS website,
COALESCE(t.tags->'phone', t.tags->'contact:phone') AS phone,
COALESCE(t.tags->'email', t.tags->'contact:email') AS email,
COALESCE(t.tags->'facebook', t.tags->'contact:facebook') AS facebook,
<ADM8REF> AS com_insee, <ADM8NAME> AS com_nom,
CONCAT('https://www.caresteouvert.fr/@', ST_Y(ST_Transform(ST_Centroid(<GEOMEMBED>), 4326)), ',', ST_Y(ST_Transform(ST_Centroid(<GEOMEMBED>), 4326)), ',17/place/',substring(<OSMID>, 1, 1), regexp_replace(<OSMID>, '.+/', '')) AS url_caresteouvert,
<GEOM>
FROM <TABLE>
WHERE (t.shop IS NOT NULL OR t.craft IS NOT NULL OR t.office IS NOT NULL) AND <GEOMCOND>
Supports Markdown
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