Skip to content

Commit

Permalink
Improving interface
Browse files Browse the repository at this point in the history
  • Loading branch information
wallytutor committed May 10, 2024
1 parent 866f77c commit f898afa
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 18 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# LOCAL
##############################################################################

# In case of opening as a vault.
.obsidian

# Content produced locally by Pelican.
/output/

Expand Down
35 changes: 18 additions & 17 deletions gpxtohtml.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,25 +171,26 @@ def get_bounds(coordinates):
return bounds

@staticmethod
def map_at_location(location, tiles):
def map_at_location(location, tiles, opts=None):
""" Create map around given location with provided tiles. """
route_map = folium.Map(
location = location,
width = "100%",
height = "100%",
left = "0%",
top = "0%",
position = "relative",
tiles = tiles.url,
attr = tiles.attribution,
crs = "EPSG3857",
control_scale= True,
prefer_canvas= False,
no_touch = True,
disable_3d = False,
png_enabled = True,
zoom_control = False
opts = opts if opts is not None else dict(
width = "100%",
height = "100%",
left = "0%",
top = "0%",
position = "relative",
crs = "EPSG3857",
control_scale = True,
prefer_canvas = False,
no_touch = True,
disable_3d = False,
png_enabled = True,
zoom_control = False
)

route_map = folium.Map(location = location, tiles = tiles.url,
attr = tiles.attribution, **opts)

return route_map

@staticmethod
Expand Down
19 changes: 18 additions & 1 deletion gpxviaferrata.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,24 @@
}
]

route_map = GpxToHtml.map_at_location(location, OPENTOPOMAP)
tiles = OPENTOPOMAP

opts = dict(
width = "100%",
height = "100%",
left = "0%",
top = "0%",
position = "relative",
crs = "EPSG3857",
control_scale = True,
prefer_canvas = False,
no_touch = True,
disable_3d = False,
png_enabled = True,
zoom_control = True
)

route_map = GpxToHtml.map_at_location(location, tiles, opts=opts)
route_map.fit_bounds(bounds)

cluster = MarkerCluster().add_to(route_map)
Expand Down

0 comments on commit f898afa

Please sign in to comment.