Le 3 décembre 2011, Vincent Pottier a écrit :
> J'ai des écarts étonnants.

Je m'étais effectivement planté avec ma requête SQL: j'avais mis un
ST_Transform(..., 900913) pour faire comme la base osm2pgsql, mais ce
n'était pas la bonne méthode.

Par contre, le spheroid de:
ST_Length_Spheroid(way,'SPHEROID["GRS_1980",6378137,298.257222101]' )
n'est pas reconnu par mon postgis. Faut-il faire quelque chose de
spécial pour que ça marche ?

Du coup, j'ai utilisé ça comme requête:

select tags->'highway' AS highway,
       count(linestring),
       round(sum(ST_Length(linestring, true)) / 1000) as kilometers
from ways
where tags ? 'highway' AND
      tags->'highway' IN (
         ('motorway'),
         ('trunk'),
         ('primary'),
         ('secondary'),
         ('tertiary'),
         ('unclassified'),
         ('residential'),
         ('track'),
         ('path'),
         ('footway')
      )
group by tags->'highway';

Et j'obtiens des résultats équivalents au tiens:


   highway    | count  | kilometers 
--------------+--------+------------
 motorway     |  11076 |      22807
 trunk        |   9586 |      12523
 primary      |  61979 |      49207
 secondary    | 119638 |     114250
 tertiary     | 159410 |     186061
 unclassified | 342973 |     218044
 residential  | 655984 |     139431
 track        | 213916 |     133137
 path         |  73003 |      37398
 footway      |  88543 |      13713


-- 
Jocelyn

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

Répondre à