コード例 #1
0
 def build_map(self, click_handler):
     mean_lat = self.x_data[self.lat_key].values.mean()
     mean_lng = self.x_data[self.lon_key].values.mean()
     # create the map
     m = Map(center=(mean_lat, mean_lng), zoom=4, basemap=basemaps.Stamen.Terrain)
     m.layout.height = '600px'
     # show trace
     markers = []
     for k in self.marker_info:
         lat, lon = k
         message = HTML()
         message.description = "Station ID"
         message.value = str(self.marker_info[k])
         message.placeholder = ""
         marker = Marker(location=(lat, lon))
         marker.on_click(click_handler)
         marker.popup = message
         markers.append(marker)
     marker_cluster = MarkerCluster(
         markers=markers
     )
     # not sure whether we could register once instead of each marker:
     # marker_cluster.on_click(click_handler)
     m.add_layer(marker_cluster)
     # m.add_control(FullScreenControl())
     return m
コード例 #2
0
 def build_map(self, click_handler: Callable[[Dict[str, Any]],
                                             None]) -> Map:
     mean_lat = self.x_data[self.lat_key].values.mean()
     mean_lng = self.x_data[self.lon_key].values.mean()
     # create the map
     m = Map(center=(mean_lat, mean_lng),
             zoom=4,
             basemap=basemaps.Stamen.Terrain)
     m.layout.height = '1200px'
     # show trace
     markers = []
     for k in self.marker_info:
         message = self.create_popup(k)
         marker = Marker(location=k, draggable=False)
         marker.on_click(click_handler)
         marker.popup = message
         markers.append(marker)
     marker_cluster = MarkerCluster(markers=markers)
     # not sure whether we could register once instead of each marker:
     # marker_cluster.on_click(click_handler)
     m.add_layer(marker_cluster)
     # m.add_control(FullScreenControl())
     return m