-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add trim_to_connected_graph for map parser and cleanups
- Loading branch information
Showing
14 changed files
with
301 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "OpenStreetMapX" | ||
uuid = "86cd37e6-c0ff-550b-95fe-21d72c8d4fc9" | ||
authors = ["Przemyslaw Szufel <[email protected]>", "Bartosz Pankratz <[email protected]>", "Anna Szczurek <[email protected]>", "Bogumil Kaminski <[email protected]>", "Pawel Pralat <[email protected]>"] | ||
version = "0.1.12" | ||
version = "0.1.13" | ||
|
||
[deps] | ||
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
[deps] | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
OpenStreetMapX = "86cd37e6-c0ff-550b-95fe-21d72c8d4fc9" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
using Documenter | ||
using Pkg | ||
|
||
try | ||
using OpenStreetMapX | ||
catch | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ Bounds | |
center | ||
inbounds | ||
onbounds | ||
latlon | ||
``` | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using OpenStreetMapX, LightGraphs, PyCall | ||
|
||
# This code assumes that folium has benn installed | ||
|
||
|
||
function plot_map(m::MapData, filename::AbstractString; tiles="Stamen Toner" ) | ||
MAP_BOUNDS = [ ( m.bounds.min_y, m.bounds.min_x), ( m.bounds.max_y, m.bounds.max_x) ] | ||
flm = pyimport("folium") | ||
m_plot = flm.Map(tiles=tiles) | ||
for e in edges(m.g) | ||
info = "Edge from: $(e.src) to $(e.dst)<br>[information from the <pre>.e</pre> and <pre>.w</pre> fields] " | ||
flm.PolyLine( (latlon(m,e.src), latlon(m,e.dst)), | ||
color="brown", weight=4, opacity=1).add_to(m_plot) | ||
end | ||
|
||
for n in keys(m.nodes) | ||
lla = LLA(m.nodes[n],m.bounds) | ||
info = "Node: $(n)\n<br>Lattitude: $(lla.lat)\n<br>Longitude: $(lla.lon)<br>[information from the <pre>.node</pre> field] " | ||
flm.Circle( | ||
(lla.lat, lla.lon), | ||
popup=info, | ||
tooltip=info, | ||
radius=10, | ||
color="orange", | ||
weight=3, | ||
fill=true, | ||
fill_color="orange" | ||
).add_to(m_plot) | ||
end | ||
|
||
for nn in keys(m.n) | ||
n = m.n[nn] | ||
lla = LLA(m.nodes[n],m.bounds) | ||
info = "Graph: $nn <br>Node: $(n)\n<br>Lattitude: $(lla.lat)\n<br>Longitude: $(lla.lon)<br> | ||
[The node identifiers are hold in the <pre>.n</pre> field and location in the <pre>.nodes</pre> field]" | ||
flm.Rectangle( | ||
[(lla.lat-0.00014, lla.lon-0.0002), (lla.lat+0.00014, lla.lon+0.0002)], | ||
popup=info, | ||
tooltip=info, | ||
color="green", | ||
weight=1.5, | ||
fill=false, | ||
fill_opacity=0.2, | ||
fill_color="green", | ||
).add_to(m_plot) | ||
end | ||
|
||
|
||
MAP_BOUNDS = [( m.bounds.min_y, m.bounds.min_x),( m.bounds.max_y, m.bounds.max_x)] | ||
flm.Rectangle(MAP_BOUNDS, color="black",weight=4).add_to(m_plot) | ||
m_plot.fit_bounds(MAP_BOUNDS) | ||
m_plot.save(filename) | ||
end | ||
|
||
pth = joinpath(dirname(pathof(OpenStreetMapX)),"..","test","data","reno_east3.osm") | ||
|
||
m2 = OpenStreetMapX.get_map_data(pth,use_cache = false, trim_to_connected_graph=true); | ||
|
||
plot_map(m2, "mymap.html") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
5c7c898
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
5c7c898
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/17418
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: