Skip to content

Commit

Permalink
based updated to Open Street Map (#139)
Browse files Browse the repository at this point in the history
* based updated to Stadia.stamentoner

* Updated basemap to open street map

* updated to open street map

* added testing printouts

* added cetering map option

* added center shifting

* updated changelog
  • Loading branch information
ywkim312 authored Nov 6, 2023
1 parent dfe3d21 commit f1e9497
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Updated
- Basemap api updated to use open street map [#138](https://github.com/IN-CORE/pyincore-viz/issues/138)

### Fixed
- Ipyleaflet map centering problem when map is called [#140](https://github.com/IN-CORE/pyincore-viz/issues/140)

## [1.8.3] - 2023-08-16
### Changed
- Pytest changed to use micromamba [#128](https://github.com/IN-CORE/pyincore-viz/issues/128)
Expand Down
8 changes: 6 additions & 2 deletions pyincore_viz/geoutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ def get_ipyleaflet_map_with_center_location(cen_lon, cen_lat, zoom_level):
obj: An ipyleaflet map.
"""
map = ipylft.Map(center=(cen_lon, cen_lat), zoom=zoom_level, basemap=ipylft.basemaps.Stamen.Toner,
map = ipylft.Map(center=(cen_lon, cen_lat), zoom=zoom_level, basemap=ipylft.basemaps.OpenStreetMap.Mapnik,
crs=projections.EPSG3857, scroll_wheel_zoom=True)

return map
Expand All @@ -963,13 +963,17 @@ def get_ipyleaflet_map(bbox=None):
obj: An ipyleaflet map.
"""
map = ipylft.Map(basemap=ipylft.basemaps.Stamen.Toner, zoom=10,
map = ipylft.Map(basemap=ipylft.basemaps.OpenStreetMap.Mapnik, zoom=10,
crs=projections.EPSG3857, scroll_wheel_zoom=True)

if bbox is not None:
# the boundary information should be converted to ipyleaflet code boundary
bounds = GeoUtil.convert_bound_to_ipylft_format(bbox)
map.fit_bounds(bounds)
# get center for different jupyter versions
center = GeoUtil.calc_center_from_bbox(bbox)
# need to reverse x and y
map.center = [center[1], center[0]]

map.add_control(ipylft.LayersControl(position='topright'))
map.add_control(ipylft.FullScreenControl(position='topright'))
Expand Down
5 changes: 3 additions & 2 deletions pyincore_viz/tabledatasetlistmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class TableDatasetListMap:
"""Mapping class for visualizing list of Table Dataset"""

def __init__(self):
self.map = ipylft.Map(center=(0, 0), zoom=12, basemap=ipylft.basemaps.Stamen.Toner, scroll_wheel_zoom=True)
self.map = ipylft.Map(center=(0, 0), zoom=12, basemap=ipylft.basemaps.OpenStreetMap.Mapnik,
scroll_wheel_zoom=True)

def create_basemap_ipylft(self, geo_dataframe, title_list):
"""Creates map window with given inventory with multiple table dataset file using folder location.
Expand All @@ -36,7 +37,7 @@ def create_basemap_ipylft(self, geo_dataframe, title_list):

# create base ipyleaflet map
self.map = ipylft.Map(center=(cen_x, cen_y), zoom=12,
basemap=ipylft.basemaps.Stamen.Toner, scroll_wheel_zoom=True)
basemap=ipylft.basemaps.OpenStreetMap.Mapnik, scroll_wheel_zoom=True)

# add map widgets
self.map = self.create_map_widgets(title_list, self.map, geo_dataframe)
Expand Down

0 comments on commit f1e9497

Please sign in to comment.