Is a .osm file of size 668.7 MB too big for the following operations?

the code runs in about 10 seconds for me.

ProgressMeter.jl can be a nice tool for such cases. You may want to check it out.

import Pkg
cd("C:\\temp\\")
Pkg.activate(".")
using Random 
using OpenStreetMapX
using ProgressMeter

function mine(itrs)
pt=splitdir(pathof(OpenStreetMapX))[1]
mx = get_map_data(joinpath(pt,"..","test","data","reno_east3.osm"),use_cache=false);
 
Random.seed!(0)
node_ids = collect(keys(mx.nodes)) 
routes = Vector{Vector{Int}}()
visits = Dict{Int,Int}()
p = Progress(itrs, 1)   # minimum update interval: 1 second
for i=1:itrs 
    a,b = [point_to_nodes(generate_point_in_bounds(mx), mx) for i in 1:2]
    route, route_time = OpenStreetMapX.shortest_route(mx,a,b)
    if route_time < Inf # when we select points neaer edges no route might be found
        push!(routes, route)
        for n in route
            visits[n] = get(visits, n,0)+1
        end 
    end
    next!(p)
    end    
    routes,visits
end

r,v=mine(5000);
1 Like