Plotting functionality for the OpenStreetMapX.jl (Supports PyPlot.jl and Plots.jl with GR backend)
Author pszufe
21 Stars
Updated Last
1 Year Ago
Started In
September 2018


Build status: Build Status

Test coverage: Coverage Status


This is a plotting companion for the OpenStreetMapX.jl package.

The package provides to plotting mechanisms for map vizualization:

  • Plots.jl with GR as a back-end
  • plotting directly to PyPlot.jl (please note that due to slower painting speed this option is reasonable only for small maps up to few thousand nodes)


The current version has been tested with Julia 1.3.1 and Julia 1.5.0

using Pkg
pkg"add OpenStreetMapX"
pkg"add OpenStreetMapXPlot"


We will show a full scenario including routing. Let us start by preparing the data and calculating a sample route.

using OpenStreetMapX

pth = joinpath(dirname(pathof(OpenStreetMapX)),"..","test","data","reno_east3.osm")
m =  get_map_data(pth,use_cache = false);
import Random
pointA = point_to_nodes(generate_point_in_bounds(m), m)
pointB = point_to_nodes(generate_point_in_bounds(m), m)
sr = shortest_route(m, pointA, pointB)[1]

Once the map data is in the memory we can start plotting. Let us start with Plots.jl with a GR back-end (this is the recommended approach due to GR's plotting speed, however due to Julia compiling process time-to-the-first-plot is around one minute, while subsequent plots can be created within few seconds).

using OpenStreetMapXPlot
import Plots
p = OpenStreetMapXPlot.plotmap(m,width=600,height=400);

Now, let us paint the same route using the plain PyPlot.jl back-end.

using OpenStreetMapXPlot
import PyPlot

Note that when using PyPlot.jl in Atom, depending on your configuration you might need to add PyPlot.display_figs() to actually see the figure


This code is a major re-write of plotting functionality of project. The creation of this source code was partially financed by research project supported by the Ontario Centres of Excellence ("OCE") under Voucher for Innovation and Productivity (VIP) program, OCE Project Number: 30293, project name: "Agent-based simulation modelling of out-of-home advertising viewing opportunity conducted in cooperation with Environics Analytics of Toronto, Canada.

Used By Packages

No packages found.