Difference between revisions of "OpenStreetMap"

From HoerupWiki
Jump to: navigation, search
(setup-osrm.sh script)
 
(16 intermediate revisions by the same user not shown)
Line 11: Line 11:
 
* [http://project-osrm.org/ osrm]
 
* [http://project-osrm.org/ osrm]
 
* [https://github.com/Project-OSRM/osrm-backend osrm github]
 
* [https://github.com/Project-OSRM/osrm-backend osrm github]
 +
 +
* [https://raw.githubusercontent.com/aquavit/Project-OSRM/master/routed.sh routed.sh init script]
 +
 +
== setup-osrm.sh script ==
  
  
Line 16: Line 20:
 
   
 
   
 
   
 
   
  DATADIR=/mnt/qnap/openstreetmap
+
  DATADIR=/home/openstreetmap
 +
 +
TAG_V510=6aed145dae4cc909a79e0989d0d732265287812a
 +
 +
 +
if [ ! -d "$DATADIR" ] ; then
 +
  echo Opretter $DATADIR
 +
  mkdir -p $DATADIR || exit
 +
fi
 
   
 
   
 
  if [ ! -f /usr/local/bin/osrm-extract ] ; then
 
  if [ ! -f /usr/local/bin/osrm-extract ] ; then
   apt-get install build-essential git cmake pkg-config libprotoc-dev  protobuf-compiler libprotobuf-dev libosmpbf-dev libpng12-dev libbz2-dev libstxxl-dev libstxxl-doc libstxxl1  
+
   apt-get install build-essential git cmake pkg-config libprotoc-dev  protobuf-compiler libprotobuf-dev libosmpbf-dev libpng12-dev libbz2-dev libstxxl-dev libstxxl1  
   apt-get install libxml2-dev libzip-dev libboost-all-dev lua5.1 liblua5.1-0-dev libluabind-dev  libtbb-dev
+
   apt-get install libxml2-dev libzip-dev libboost-all-dev lua5.1 liblua5.1-0-dev libluabind-dev  libtbb-dev
 +
  apt-get install libsparsehash-dev libgdal-dev
 
   
 
   
 
   
 
   
   cd /root
+
   cd ~
 
   
 
   
 
   git clone https://github.com/Project-OSRM/osrm-backend.git
 
   git clone https://github.com/Project-OSRM/osrm-backend.git
 
   cd osrm-backend
 
   cd osrm-backend
 +
 
 +
  # get v5.1.0 tag
 +
  git reset --hard TAG_V510
 +
 
 
   mkdir -p build
 
   mkdir -p build
 
   cd build
 
   cd build
 
   
 
   
   cmake ..
+
   cmake .. || exit
   make -j 2
+
   make -j2 || exit
   make install
+
   make install || exit
 
  fi
 
  fi
 
   
 
   
Line 43: Line 60:
 
  if [ ! -f denmark-latest.osm ] ; then
 
  if [ ! -f denmark-latest.osm ] ; then
 
   wget http://download.geofabrik.de/europe/denmark-latest.osm.bz2
 
   wget http://download.geofabrik.de/europe/denmark-latest.osm.bz2
 +
  echo "------- running bunzip2 -------------"
 
   bunzip2 denmark-latest.osm.bz2
 
   bunzip2 denmark-latest.osm.bz2
 
  fi
 
  fi
 
   
 
   
  cd /root/osrm-backend
+
  cd ~/osrm-backend*
 
   
 
   
 
  if [ ! -f $DATADIR/denmark-latest.osrm ] ; then
 
  if [ ! -f $DATADIR/denmark-latest.osrm ] ; then
 +
  echo "------- running osrm-extract -------------"
 
   osrm-extract $DATADIR/denmark-latest.osm
 
   osrm-extract $DATADIR/denmark-latest.osm
 
  fi
 
  fi
 
   
 
   
  if [ ! -f $DATADIR/denmark-latest.osrm.edges ] ; then
+
  if [ ! -f $DATADIR/denmark-latest.osrm.hsgr ] ; then
   osrm-prepare $DATADIR/denmark-latest.osrm
+
  echo "------- running osrm-contract -------------"
 +
   osrm-contract $DATADIR/denmark-latest.osrm
 
  fi
 
  fi
 
   
 
   
 
  cd $DATADIR
 
  cd $DATADIR
 +
echo "------- running osrm-routed -------------"
 +
osrm-routed denmark-latest.osrm
 +
 +
== start-osrm.sh script ==
 +
#!/bin/bash
 +
 +
killall -9 osrm-routed
 
   
 
   
  osrm-routed denmark-latest.osrm
+
rm -f nohup.out
 +
  osrm-datastore /home/openstreetmap/denmark-latest.osrm
 +
 +
nohup osrm-routed -s &

Latest revision as of 14:34, 23 May 2016

GeoCoding

Routing

setup-osrm.sh script

#!/bin/bash


DATADIR=/home/openstreetmap

TAG_V510=6aed145dae4cc909a79e0989d0d732265287812a


if [ ! -d "$DATADIR" ] ; then
  echo Opretter $DATADIR
  mkdir -p $DATADIR || exit
fi

if [ ! -f /usr/local/bin/osrm-extract ] ; then
 apt-get install build-essential git cmake pkg-config libprotoc-dev  protobuf-compiler libprotobuf-dev libosmpbf-dev libpng12-dev libbz2-dev libstxxl-dev libstxxl1 
 apt-get install libxml2-dev libzip-dev libboost-all-dev lua5.1 liblua5.1-0-dev libluabind-dev  libtbb-dev 
 apt-get install libsparsehash-dev libgdal-dev


 cd ~

 git clone https://github.com/Project-OSRM/osrm-backend.git
 cd osrm-backend
 
 # get v5.1.0 tag
 git reset --hard TAG_V510
 
 mkdir -p build
 cd build

 cmake .. || exit
 make -j2 || exit
 make install || exit
fi


##########################################


cd $DATADIR

if [ ! -f denmark-latest.osm ] ; then
  wget http://download.geofabrik.de/europe/denmark-latest.osm.bz2
  echo "------- running bunzip2 -------------"
  bunzip2 denmark-latest.osm.bz2
fi

cd ~/osrm-backend*

if [ ! -f $DATADIR/denmark-latest.osrm ] ; then
  echo "------- running osrm-extract -------------"
  osrm-extract $DATADIR/denmark-latest.osm
fi

if [ ! -f $DATADIR/denmark-latest.osrm.hsgr ] ; then
  echo "------- running osrm-contract -------------"
  osrm-contract $DATADIR/denmark-latest.osrm
fi

cd $DATADIR
echo "------- running osrm-routed -------------"
osrm-routed denmark-latest.osrm

start-osrm.sh script

#!/bin/bash

killall -9 osrm-routed

rm -f nohup.out
osrm-datastore /home/openstreetmap/denmark-latest.osrm

nohup osrm-routed -s &