Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pszufe committed Mar 8, 2024
1 parent 41cf2c8 commit c26f690
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Binary file modified docs/src/poiviz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 6 additions & 7 deletions docs/src/visualize.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,25 @@

## How to visualize the data

The library can be integrated with various vizualisation frameworks. Below we show two example codes that can be a base for further exploration. The first example uses `folium` via `PyCall` while the second example uses `Plots.jl` combined with [`OpenStreetMapXPlot.jl`](https://github.com/pszufe/OpenStreetMapXPlot.jl).
The library can be integrated with various vizualisation frameworks. Below we show two example codes that can be a base for further exploration. The first example uses `folium` via `PythonCall` (`using CondaPkg; CondaPkg.add_channel("conda-forge"); CondaPkg.add("folium")`) while the second example uses `Plots.jl` combined with [`OpenStreetMapXPlot.jl`](https://github.com/pszufe/OpenStreetMapXPlot.jl).


### Point of interest with Python folium via PyCall

Below is a sample piece of code that can be used to generate a visualization of POIs on a map.
```julia
using PyCall
using Colors
using OSMToolset
using PythonCall, Colors, OSMToolset

file = sample_osm_file()
df = find_poi(file)
ix = AttractivenessSpatIndex(df);

flm = pyimport("folium");
flm = PythonCall.pyimport("folium");

colrs = distinguishable_colors(length(ix.measures), [RGB(0.1,0.2,0.4)])
class2col = Dict(ix.measures .=> colrs);

m = flm.Map(tiles = "Stamen Toner")
m = flm.Map(tiles = "Cartodb Positron")
line = 0

for row in eachrow(df)
Expand All @@ -34,7 +33,7 @@ for row in eachrow(df)

end
bb = getbounds(file)
bounds = [(bb.minlat, Float64(bb.minlon)), (bb.maxlat, Float64(bb.maxlon))]
bounds = ((bb.minlat, Float64(bb.minlon)), (bb.maxlat, Float64(bb.maxlon)))
m.fit_bounds(bounds)
flm.Rectangle(bounds, color="blue",weight=2).add_to(m)

Expand Down

0 comments on commit c26f690

Please sign in to comment.