Skip to content

Commit

Permalink
Merge branch 'master' into 042-compat-ted
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/routing.jl
  • Loading branch information
tedsteiner committed Jan 1, 2016
2 parents 213e965 + fa245ef commit de5387c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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())'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/routing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions test/routes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit de5387c

Please sign in to comment.