diff --git a/.travis.yml b/.travis.yml index 4e14b6a..b042c4c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,3 +23,4 @@ script: - julia -e 'Pkg.test("OpenStreetMap", coverage=true)' after_success: - julia -e 'cd(Pkg.dir("OpenStreetMap")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())' + - julia -e 'cd(Pkg.dir("OpenStreetMap")); using Coverage; Codecov.submit(Codecov.process_folder())' diff --git a/README.md b/README.md index 4520915..2117cd2 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ This package provides basic functionality for parsing, viewing, and working with * Filter data by various classes: * Ways suitable for driving, walking, or cycling * Freeways, major city streets, residential streets, etc. - * Accomodations, shops, industry, etc. + * Accommodations, shops, industry, etc. * Draw detailed maps using Julia's [Winston](https://github.com/nolta/Winston.jl) graphics package with a variety of options * Compute shortest or fastest driving, cycling, and walking routes using Julia's Graphs package diff --git a/src/routing.jl b/src/routing.jl index f062a5f..2e0faaf 100644 --- a/src/routing.jl +++ b/src/routing.jl @@ -152,6 +152,10 @@ end ### Compute the distance of a route ### function Geodesy.distance{T<:@compat(Union{ENU,ECEF})}(nodes::Dict{Int,T}, route::Vector{Int}) + if length(route) == 0 + return Inf + end + dist = 0.0 prev_point = nodes[route[1]] for i = 2:length(route) diff --git a/test/routes.jl b/test/routes.jl index 237b082..157e180 100644 --- a/test/routes.jl +++ b/test/routes.jl @@ -56,6 +56,9 @@ fastest_distance = distance(nodesENU, fastest_route) @test fastest_route[20] == 2472339219 @test fastest_route[end] == node1 +# Empty route +@test distance(nodesENU, Int[]) == Inf + # Get route edge list shortest_edges = routeEdges(network, shortest_route) @test length(shortest_edges) == 22