Come on, you'reĀ  leaving us out on a limb. Now we want to know the world
leader in relation membership :-).


Am 27.08.2018 um 01:00 schrieb Frederik Ramm:
> Hi,
>
> in the course of a discussion over on talk-gb, I wanted to find out
> which ways have the highest number of relation memberships. In case
> someone is interested, here's how to do it with Osmium and Perl.
>
> 1. create this Perl script which reads "opl" ascii format
>
> #!/usr/bin/perl
>
> while(<>)
> {
>     next unless /boundary/;
>     s/.* M//g;
>     foreach (split(/,/))
>     {
>         my ($a,$b)=split(/@/);
>         $mem{$a}++;
>     }
> }
>
> $i=0;
> foreach (sort { $mem{$b}<=>$mem{$a} } keys(%mem))
> {
>     printf "%d %s\n", $mem{$_}, $_;
>     last if ($i++>100);
> }
>
> 2. feed an .osm.pbf file into it:
>
> osmium cat some-file.osm.pbf -trelation -fopl | perl myscript.pl
>
> I ran this for England and found a small number of ways that were
> actually in over 100 different (bus route) relations ;)
>
> If you like Python, you could of course do the whole thing in one go
> using the PyOsmium library
>
> Bye
> Frederik
>


Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
dev mailing list
dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/dev

Reply via email to