NAME
Geo::Routing::Driver::Gosmore - Gosmore driver for Geo::Routing
SYNOPSIS
First install gosmore(1), e.g. on Debian:
sudo aptitude install gosmore
Then build a gosmore.pak file:
wget http://download.geofabrik.de/osm/europe/british_isles.osm.bz2
# pv(1) is not needed, it just shows you the import progress
bzcat british_isles.osm.bz2 | pv | gosmore rebuild
Then use this library, with gosmore_path
being the full path to your new gosmore.pak.
my $gosmore = Geo::Routing->new(
gosmore_path => $gosmore_path,
);
my $query = Geo::Gosmore::Query->new(
flat => '51.5425',
flon => '-0.111',
tlat => '51.5614',
tlon => '-0.0466',
fast => 1,
v => 'motorcar',
);
# Returns false if we can't find a route
my $route = $gosmore->route($query);
my $distance = $route->distance;
DESCRIPTION
Provides an interface to the headless version of the gosmore routing library. When compiled with headless support it provides a simple interface to do routing. This library just parses its simple output and provides accessors for it.
We also support accessing the headless gosmore(1) program through a remote CGI interface.
ATTRIBUTES
gosmore_method
Either binary
or http
. If binary "gosmore_path" is a path to a gosmore.pak and we'll invoke gosmore(1) from your $PATH
.
If it's http
"gosmore_path" is a URL to an online gosmore router.
gosmore_path
Either a path to a gosmore.pak (see "gosmore_method") or a HTTP URL to a gosmore CGI routing script without query parameters.