Le 16/12/2009 14:53, Emilie Laffray a écrit :
> ST_Length ne retourne que des valeurs dans l'unite de la projection sauf
> si tu precises un spheroid. A noter qu'il faut Postgis 1.5 (en cours de
> development) pour avoir le support geodesique.
> http://postgis.refractions.net/documentation/manual-svn/ST_Length.html
> pour la version sur svn
>
> Documentation actuelle.
> http://postgis.refractions.net/documentation/manual-1.3/ch06.html
> ST_Length_spheroid
>
> Si tu veux une distance en metres, il me semble que tu dois pouvoir
> faire une projection dans une zone UTM. Si tu fais la retroprojection a
> chaque calcul ca va etre tres lent evidemment
> http://trac.osgeo.org/postgis/wiki/UsersWikiNewbieMeasurementInMeters

Si je copie cette doc pour la projection UTM, ça donne :

SELECT route.highway,
        floor(
         sum(
          st_length(
           st_transform(
            st_intersection(zone.way, route.way),
            2163
           )
          )
         )
        ) 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;

     highway    | distance
---------------+----------
  cycleway      |    22733
  service       |    42273
  footway       |    62206
  motorway      |     4298
  tertiary      |   117015
  unclassified  |    97834
  trunk_link    |     7604
  pedestrian    |     9976
  motorway_link |     1301
  residential   |   329718
  steps         |     1644
  trunk         |    18254
  road          |     2712
  path          |    21562
  living_street |      207
  track         |     1911
  secondary     |    92675
  primary       |    60299
  bus_guideway  |     4236
  construction  |      397

-- 
Etienne

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

Répondre à