Le 16/12/2009 13:45, Emilie Laffray a écrit :
> Pour Postgis, tu peux avoir la distance entre deux points avec
> ST_Distance_sphere en mètres. Tu peux donc "facilement" écrire une
> requête qui calculera la distance d'une way en mètres.

Dans ce cas, avec une base postgis tu peux faire :

SELECT route.highway, floor(sum(st_length(st_intersection(zone.way, 
route.way)))) AS distance FROM (SELECT highway, way FROM france_line 
WHERE highway<>'') AS route, (SELECT way FROM france_polygon WHERE 
name='Nantes') AS zone WHERE zone.way && route.way  AND 
st_intersects(zone.way, route.way) GROUP BY route.highway;

pour avoir les distances sur Nantes, et tu obtiens :
     highway    | distance
---------------+----------
  cycleway      |    32259
  service       |    61078
  footway       |    89917
  motorway      |     5648
  tertiary      |   167958
  unclassified  |   140163
  trunk_link    |    11482
  pedestrian    |    14227
  motorway_link |     1780
  residential   |   479245
  steps         |     2441
  trunk         |    28421
  road          |     3897
  path          |    31083
  living_street |      284
  track         |     2740
  secondary     |   132896
  primary       |    87875
  bus_guideway  |     6703
  construction  |      620

st_distance marche que pour deux points à en croire la doc, j'espère que 
st_length donne bien des mètre, mais ça semble être le cas.

-- 
Etienne

_______________________________________________
Talk-fr mailing list
Talk-fr@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk-fr

Répondre à