#!/bin/sh


echo ========== temp finish updating =========

#Settings on my laptop
#export OSMOSIS_HOME="/home/harry/planet/osmosis-SNAPSHOT-r23583"
#export PLANET_HOME="/home/harry/planet/waychains"

#Setting on dev.openstreetmap.org
export OSMOSIS_HOME="/home/harrywood/bin/osmosis-SNAPSHOT-r23583"
export PLANET_HOME="/home/harrywood/public_html/waychains"


if  [ ! -d $OSMOSIS_HOME ]
then
   echo OSMOSIS_HOME $OSMOSIS_HOME directory does not exist; exit 1
fi

if  [ ! -d $PLANET_HOME ]
then
   echo OSMOSIS_HOME $PLANET_HOME directory does not exist; exit 1
fi




echo Simplifying motorways
rm $PLANET_HOME/us-motorways-simplified.osm
$OSMOSIS_HOME/bin/osmosis -p org.openstreetmap.osmosis.plugins.simplify.SimplifyPlugin \
     --read-xml file=$PLANET_HOME/us-motorways.osm \
     --simplify \
     --write-xml $PLANET_HOME/us-motorways-simplified.osm
     
     
#

if  [ ! -s $PLANET_HOME/us-motorways-simplified.osm ]
then
   echo $PLANET_HOME/us-motorways-simplified.osm file does not exist. Something went wrong with simplifying motorways; exit 1
fi


     
     
ruby $PLANET_HOME/waychainsummary.rb $PLANET_HOME/us-motorways-simplified.osm


date
echo DONE


