def get_latlon_at(self, x, y, zoom=None): """Return the current :class:`Coordinate` within the (x, y) widget coordinate. """ if zoom is None: zoom = self._zoom vx, vy = self.viewport_pos return Coordinate(lat=self.map_source.get_lat(zoom, y + vy), lon=self.map_source.get_lon(zoom, x + vx))
def do_update(self, dt): zoom = self._zoom self.lon = self.map_source.get_lon(zoom, (self.center_x - self._scatter.x)/self.scale - self.delta_x) self.lat = self.map_source.get_lat(zoom, (self.center_y - self._scatter.y)/self.scale - self.delta_y) for layer in self._layers: layer.reposition() self.dispatch("on_map_relocated", zoom, Coordinate(self.lon, self.lat)) if self._need_redraw_full: self._need_redraw_full = False self.move_tiles_to_background() self.load_visible_tiles() else: self.load_visible_tiles()