The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Geo::Gosmore - Interface to the headless gosmore(1) routing application

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_pak being the full path to your new gosmore.pak.

    my $gosmore = Geo::Gosmore->new(
        gosmore_pak => $gosmore_pak,
    );

    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.

This is experimental software with an API subject to change.

LICENSE AND COPYRIGHT

Copyright 2011 Ævar Arnfjörð Bjarmason <avar@cpan.org>

This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.