[OSM-talk-fr] Re : Statistiques OSM france

Steven Le Roux steven at le-roux.info
Ven 11 Avr 14:21:34 UTC 2008


2008/4/11 GARETTE Emmanuel <gnunux at gnunux.info>:

> On Fri, 11 Apr 2008 15:33:29 +0200, Pierre Mauduit
> <pierre.mauduit at gmail.com> wrote:
> > Salut,
> > C'est loin d'etre parfait, mais ca a l'air de fonctionner.
>
> if [ `cat hexagone-latest.osm | grep '</osm>' | wc -l` -eq 1 ]
>
> Tu ferais mieux de faire un grep sur le fichier directement plutot que le
> cat pour en faire un grep.
>
> if [ ! "x`grep '</osm>' hexagone-latest.osm`" = "x" ]
>
>
Yep, mais le mieux est d'éviter de décompresser au maximum :)

voilà une version factorisée :

#!/bin/bash

echo "Destroying old archives :`rm -f *.osm*` Done"
echo "Fetching latest hexagon :`wget -q
http://hexagone.openstreetmap.fr/hexagone-latest.osm.bz2` Done"

if [ `bzgrep '</osm>' hexagone-latest.osm.bz2 | wc -l` -eq 1 ]
    then
        echo "no osm end tag bug";
        echo "Importating datas `su -c "./osm2pgsql -m
hexagone-latest.osm.bz2" postgres` Done."
    else
        bunzip2 hexagone-latest.osm.bz2
        echo -n "osm end tag bug, processing :`bunzip2
hexagone-latest.osm.bz2` `echo '</osm>' >> hexagone-latest.osm`  Done.";
        echo "Importating datas `su -c "./osm2pgsql -m hexagone-latest.osm"
postgres` Done."
fi


-- 
Steven Le Roux
Jabber-ID : Steven at jabber.fr
-------------- section suivante --------------
Une pièce jointe HTML a été nettoyée...
URL: <http://lists.openstreetmap.org/pipermail/talk-fr/attachments/20080411/edd096e5/attachment.htm>


Plus d'informations sur la liste de diffusion Talk-fr