pszufe / OpenStreetMapX.jl

OpenStreetMap (*.osm) support for Julia 1.0 and up
MIT License
119 stars 24 forks source link

nodes parameter is not needed in the following function? #19

Open bsnyh opened 4 years ago

bsnyh commented 4 years ago

Hi, just a tiny question. I was wondering, the parameter nodes::Dict{Int,T} is not needed in the following function, right?

function get_edges(nodes::Dict{Int,T},roadways::Vector{OpenStreetMapX.Way}) where T<:Union{OpenStreetMapX.ENU,OpenStreetMapX.ECEF}
    oneway_roads = map(OpenStreetMapX.oneway,roadways)
    reverse_roads = map(OpenStreetMapX.reverseway,roadways)
    classes = OpenStreetMapX.classify_roadways(roadways)
    edges = Dict{Tuple{Int,Int},Int}()
    for i = 1:length(roadways)                 # fix a roadway index i
        for j = 2:length(roadways[i].nodes)    # fix a node index j
            n0 = roadways[i].nodes[j-1]
            n1 = roadways[i].nodes[j]
            start = n0 * !reverse_roads[i] + n1 * reverse_roads[i]
            fin = n0 * reverse_roads[i] + n1 * !reverse_roads[i]
            edges[(start,fin)] = classes[roadways[i].id]
            oneway_roads[i] || (edges[(fin,start)] = classes[roadways[i].id])
        end
    end
    return collect(keys(edges)), collect(values(edges))
end

One more question, I was just wondering, is a documentation for this OpenStreetMapX package necessary / needed? If so, I probably can write one I guess.

pszufe commented 4 years ago

Yes, the parameter is not needed. This is another leftover from code cleanup.

Regarding the documentation - you are welcome to contribute. I can support you with technical issues. There is quite a lot of documentation that can be also moved from https://openstreetmapjl.readthedocs.io/en/stable/