[OSM-talk] Road network length calculation
Jukka Rahkonen
jukka.rahkonen at mmmtike.fi
Sun Mar 22 06:21:22 GMT 2009
Frederik Ramm <frederik <at> remote.org> writes:
>
> Hi,
>
> Tomas Straupis wrote:
> > Is there an app to calculate length of given types of ways in .osm file?
>
> Yes, using the tools in SVN under applications/utils/filter/osm-length/.
>
> Bye
> Frederik
This tool seems to offer just what you want. Another way might be to import the
data into PostGIS and run queries there.
- import .som file into PostGIS with osm2pgsql
- calculate length in PostGIS
For example, I use to import osm data into postgis and transform it it Finnish
kkj projection. Now I can get the length (in meters) of all "highway" lines of
the Finland.osm with query
postgis=# select sum(length2d(way)) from osm_line where highway is not null;
-----------------
120547380.61163
(1 row)
PostGIS gives much flexibility with queries, for example the length of unnamed
unclassified highways in epsg:3067 projection
postgis=# select sum(length2d(way2)) from
(select transform(way,3067) as way2 from osm_line where highway='unclassified'
and name is null) as foo;
------------------
42116706.9329842
(1 row)
More information about the talk
mailing list