User:NicolasDumoulin/RéseauCyclableClermontCo

From OpenStreetMap Wiki
Jump to: navigation, search

Projet de rendu du réseau cyclable de Clermont-communauté

Prototype en ligne

À faire :

  • Légende et boutons rapides pour changer de couche (sans le menu masquable OpenLayers)
  • Affichage parkings à vélo
  • Afficher la liste des rues concernées par communes ou sur la zone affichée

Liens généraux :

Récupération des données

Avec XAPI

Zone prise en compte : bbox=3.0323,45.6793,3.252,45.8508

 wget -O 'highway=cycleway.osm' 'http://xapi.openstreetmap.org/api/0.6/*[bbox=3.0323,45.6793,3.252,45.8508][highway=cycleway]'
 wget -O 'cycleway_lane.osm' 'http://xapi.openstreetmap.org/api/0.6/*[bbox=3.0323,45.6793,3.252,45.8508][cycleway|cycleway:right|cycleway:left=lane]'
 wget -O 'cycleway=opposite_lane.osm' 'http://xapi.openstreetmap.org/api/0.6/*[bbox=3.0323,45.6793,3.252,45.8508][cycleway=opposite_lane]'
 wget -O 'path_bicycle_designated.osm' 'http://xapi.openstreetmap.org/api/0.6/*[bbox=3.0323,45.6793,3.252,45.8508][highway=path][bicycle=designated'
Avec osmosis
osmosis --rx ../grandClermont.xml --tf accept-ways highway=cycleway --used-node --wx highway.cycleway.osm
osmosis --rx ../grandClermont.xml --tf accept-ways cycleway=opposite_lane --used-node --wx cycleway.opposite_lane.osm
osmosis --rx ../grandClermont.xml --tf accept-ways cycleway=lane cycleway:right=lane cycleway:left=lane --used-node --wx cycleway.lane.osm

Solutions techniques pour le rendu avec Openlayers =

Production de statistiques

Avec un serveur postgis, on peut établir des requêtes pour obtenir :

  • la longueur des bandes cyclables par commune :
    • version simple
 select c.name as Commune,sum(length(l.way)) as Longueur
 from "public".planet_osm_polygon as c join "public".planet_osm_line as l
   on l.cycleway='lane' AND (ST_Contains(c.way, l.way) OR ST_Intersects(c.way, l.way))
 where c.admin_level='8'
 group by c.name
 order by Voies_cyclables;
    • version plus complète :
select r1.Commune,
       r1.longueur as "Bandes deux sens",
       r2.longueur as "Bande sens unique",
       opposite.longueur as "Contre-sens",
       r3.longueur as "Bande simple",
       2*r1.longueur + r2.longueur + opposite.longueur + r3.longueur as "Total linéaire"
from
-- cycleway=lane sans oneway
(
  select c.name as Commune, coalesce(sum(length(l.way)),'0') as longueur
  from "public".planet_osm_polygon as c
    left join "public".planet_osm_line as l
      on l.cycleway='lane' AND (l.oneway='no' OR l.oneway IS NULL) AND (ST_Contains(c.way, l.way) OR ST_Intersects(c.way, l.way))
  where c.admin_level='8'
  group by c.name
) as r1,
-- cycleway=lane et oneway=yes
(
  select c.name as Commune, coalesce(sum(length(l.way)),'0') as longueur
  from "public".planet_osm_polygon as c
    left join "public".planet_osm_line as l
      on l.cycleway='lane' AND l.oneway='yes' AND (ST_Contains(c.way, l.way) OR ST_Intersects(c.way, l.way))
  where c.admin_level='8'
  group by c.name
) as r2,
-- cycleway:opposite=lane
(
  select c.name as Commune, coalesce(sum(length(l.way)),'0') as longueur
  from "public".planet_osm_polygon as c
    left join "public".planet_osm_line as l
      on l."cycleway"='opposite_lane' AND (ST_Contains(c.way, l.way) OR ST_Intersects(c.way, l.way))
  where c.admin_level='8'
  group by c.name
) as opposite,
-- cycleway:left=lane et cycleway:right=lane
(
  select c.name as Commune, coalesce(sum(length(l.way)),'0') as longueur
  from "public".planet_osm_polygon as c
    left join "public".planet_osm_line as l
      on (l."cycleway:right"='lane' OR l."cycleway:left"='lane') AND (ST_Contains(c.way, l.way) OR ST_Intersects(c.way, l.way))
  where c.admin_level='8'
  group by c.name
) as r3
where r1.commune = r2.commune AND r1.commune=opposite.commune AND r1.commune=r3.commune AND (r1.longueur <> '0' OR r2.longueur <> '0' OR opposite.longueur <> '0' OR r3.longueur <> '0');