def create_map(self, *args): _, latitude, longitude, markers = args markers = pickle.loads(markers) map = MapView(zoom=12, lat=latitude, lon=longitude, size_hint=(1, .8)) marker_layer = MarkerMapLayer() map.add_layer(marker_layer) for (lat, lon) in markers: # print(type(lat),type(lon)) map.add_marker(MapMarker(lat=lat, lon=lon, source='images/mmy_marker.png'), layer=marker_layer) return map
def show(self): if self.root: self.root.clear_widgets() self.layout = FloatLayout() if platform == "ios": user_data_dir = App.get_running_app().user_data_dir self.mapview = MapView(zoom=map_zoom, lat=self.center[0], lon=self.center[1], cache_dir=join(user_data_dir, "cache_dir")) else: self.mapview = MapView(zoom=map_zoom, lat=self.center[0], lon=self.center[1]) self.layout.add_widget(self.mapview) self.root.add_widget(self.layout) vbox = BoxLayout(orientation='vertical', height='64dp', size_hint_y=None) bmessage = BoxLayout( orientation='horizontal', height='32dp', #size_hint_y=None, size_hint=(None, None), pos_hint={'x': 0.20}, #pos=(10,10) ) self.msg_label = Label( text="", markup=True, #size_hint_x=None, height=40, #size_hint_y=None, height=40, size_hint=(None, None), #pos=(.20,.20), #pos_hint={'x':0.10} ) bmessage.add_widget(self.msg_label) vbox.add_widget(bmessage) self.buttons = BoxLayout(orientation='horizontal', height='32dp', size_hint_y=None) self.msg_btn = Button(text="Message", on_press=lambda a: self.message()) self.buttons.add_widget(self.msg_btn) self.cfg_btn = Button(text="Configure", on_press=lambda a: self.portal()) self.buttons.add_widget(self.cfg_btn) vbox.add_widget(self.buttons) self.root.add_widget(vbox) # Running functions from configure.py for f in functions: getattr(self, f)()
def __init__(self, walking_widget): super().__init__() self.walking_widget = walking_widget self.widget_layout = FloatLayout() self.origin_size = (1, 1) self.map_view = MapView(zoom=12, lat=37.5606, lon=126.9790) # gps에서 현재위치 받아서 띄우기 self.cur_lat, self.cur_lon = 37.5606, 126.9790 self.marker_layer = MarkerMapLayer() self.map_view.add_layer(self.marker_layer) self.positions = [(self.cur_lat, self.cur_lon)] self.save_button = Button(text='save', pos_hint={ 'x': 0.0, 'y': 0.0 }, size_hint=(.1, .1)) self.clear_button = Button(text='clear', pos_hint={ 'x': 0.1, 'y': 0.0 }, size_hint=(.1, .1)) self.items_bind()
def build(self): map = MapView() source = MapSource( url="http://localhost:8080/whistler_tiles/{z}/x{x}_y{y}.png", max_zoom=6) map.map_source = source return map
def build(self): #mapview = MapView(zoom=16, lat=35.689767500000, lon=139.767127800000) #lat: 35.681382 lon: 139.766084 mapview = MapView(zoom=15, lat=35.681382, lon=139.766084) marker1 = MapMarkerPopup(lat=35.681382, lon=139.766084) mapview.add_marker(marker1) return mapview
def show(self): if self.root: self.root.clear_widgets() print "Show!!!" self.layout = FloatLayout() self.mapview = MapView(zoom=map_zoom, lat=self.center[0], lon=self.center[1]) self.layout.add_widget(self.mapview) self.root.add_widget(self.layout) self.buttons = BoxLayout(orientation='horizontal', height='32dp', size_hint_y=None) self.msg_btn = Button(text="Message", on_press=lambda a: self.message()) self.buttons.add_widget(self.msg_btn) self.cfg_btn = Button(text="Configure", on_press=lambda a: self.portal()) self.buttons.add_widget(self.cfg_btn) self.root.add_widget(self.buttons) # Running functions from configure.py for f in functions: getattr(self, f)()
def build(self): self.itu_lat = 55.6593807 self.itu_lon = 12.5910774 self.obs_dic = None self.old_time = 0.0 self.Layout = RelativeLayout(size=(900, 450)) self.mapview = MapView(zoom=17, lat=self.itu_lat, lon=self.itu_lon) self.Layout.add_widget(self.mapview) self.overlay = AnchorLayout(anchor_x='right', anchor_y='top') # btn = Button(text="test", size_hint=(.2, .2)) # btn = Button(background_normal='Settings G.png', size=(0.2, 0.2), pos=(100,100)) self.btn = Button(background_normal='Settings B.png', size_hint=(0.06, 0.1)) self.overlay.add_widget(self.btn) self.Layout.add_widget(self.overlay) self.btn.bind(on_press=self.show_dropdown) marker = MapMarker(anchor_x=0.5, anchor_y=0.5, lat=self.itu_lat, lon=self.itu_lon) self.mapview.add_marker(marker) return self.Layout
def build(self): layout = BoxLayout(orientation='vertical') self.mapview = MapView(zoom=7, lat=42.6394, lon=25.057) bubble = Bubble(orientation="horizontal", padding=5) text = "[b]Sample text here[/b]" label = Label(text=text, markup=True, halign="center") bubble.add_widget(label) marker = MapMarkerPopup(id="first", lat=42.6394, lon=25.057, popup_size=('150dp', '100dp')) marker.add_widget(bubble) self.mapview.add_marker(marker) b = BoxLayout(orientation='horizontal', height='52dp', size_hint_y=None) b.add_widget( Button(text="Zoom in", on_press=lambda a: setattr(self.mapview, 'zoom', self. mapview.zoom + 1))) b.add_widget( Button(text="Zoom out", on_press=lambda a: setattr(self.mapview, 'zoom', self. mapview.zoom - 1))) layout.add_widget(b) layout.add_widget(self.mapview) return layout
def on_enter(self): # Map with Zoom and Coordinates mapview = MapView(zoom=18, lat=cur_lat, lon=cur_lon) # TODO: use ros variables for coordinates # Back to Menu Button def changeScreen(self): sm.transition = SlideTransition(direction='right') sm.current = "MNS" backBtn = Button(text="[b]BACK[/b]", font_size="20sp", pos=(0, 0), size_hint=(.2, .1), background_color=(1, 1, 1, 0.45), markup=True) backBtn.bind(on_press=changeScreen) self.add_widget(mapview) with self.canvas: carSize = 15 Color(1, 0, 0, 1) # set the colour to red self.elliple = Ellipse(pos=self.center, size=(carSize, carSize)) # Add to Map layout self.add_widget(backBtn)
def build(self): global zoom1 global lon1 global lat1 map = MapView(zoom=zoom1, lat=lat1, lon=lon1, double_tap_zoom=False) marker_1 = MapMarker(lon=17.03, lat=51.1) map.add_marker(marker_1) return map
def build(self): self.mapview = MapView(lat=51.48, lon=-3.17, zoom=11) self.mapLayer = MarkerMapLayer() for i in locations: locationLat = float(locations[i][0]) locationLon = float(locations[i][1]) marker = MapMarker(lat=locationLat, lon=locationLon) self.mapLayer.add_widget(marker) self.mapview.add_layer(self.mapLayer) self.add_widget(self.mapview)
def build(self): req = urllib2.Request("http://api.open-notify.org/iss-now.json") response = urllib2.urlopen(req) obj = json.loads(response.read()) print(obj) print(obj['iss_position']['latitude']) latPos = obj['iss_position']['latitude'] lonPos = obj['iss_position']['longitude'] mapview = MapView(zoom=5, lat=obj['iss_position']['latitude'], lon=obj['iss_position']['longitude']) return mapview
def build(self): self.root = GridLayout(rows=2) self.b1 = Button() # self.root.add_widget(self.b1) self.mapview = MapView(zoom=10, lat=51.144894309328016, lon=17.017822265625004) self.root.add_widget(self.mapview) self.plane = Plane(self.mapview) self.plane.update(1) #Clock.schedule_interval(self.plane.update, 1.0 / 1.0) return self.root
def __init__(self): super().__init__() self.origin_size = (1, 1) self.widget_layout = FloatLayout() #줌을 12에서 붐비는정도라는 의도에 걸맞게 zoom을 높여주기 -> ux 개선사항 self.map_view = MapView(zoom=14, lat=37.5606, lon=126.9790) # gps에서 현재위치 받아서 띄우기 self.cur_lat, self.cur_lon = 37.5606, 126.9790 self.marker_layer = MarkerMapLayer() self.map_view.add_layer(self.marker_layer) self.items_bind()
def __init__(self, **kwargs): #super(ISSScreen, self).__init__(**kwargs) super(ISSScreen, self).__init__() self.name = kwargs["name"] # Set the path for the folder self.path = os.path.dirname(os.path.abspath(__file__)) # Set the path for local images self.imagefolder = os.path.join(self.path, "images") # Ephem calculates the position using the Two Line Element data # We need to make sure we have up to date info tle = self.get_TLE() # Create an iss object from which we can get positional data self.iss = ephem.readtle(*tle) # Run the calculations self.iss.compute() # Get positon of iss and place a marker there lat, lon = self.get_loc() self.marker = MapMarker(lat=lat, lon=lon) # Create a value to check when we last drew ISS path self.last_path_update = 0 # Create the path icon self.path_icon = os.path.join(self.imagefolder, "dot.png") # Create the world map #self.map = MapView(id="mpv",lat=0, lon=0, zoom=1, scale=1.5) self.map = MapView(lat=0, lon=0, zoom=1) x, y = self.map.get_window_xy_from(0, 0, 1) self.map.scale_at(1.2, x, y) # Add the ISS marker to the map and draw the map on the screen print("add map") self.map.add_widget(self.marker) print("add widget") self.add_widget(self.map) # Add a new layer for the path self.mmlayer = MarkerMapLayer() self.draw_iss_path() self.timer = None
def __init__(self, **kwargs): super(RootWidget, self).__init__(**kwargs) self.anchor_x = 'right' self.anchor_y = 'top' mapview = MapView(zoom=11, lat=self.lat, lon=self.lon) self.add_widget(mapview) toolbar = MDToolbar( title="Map", background_palette="Primary", background_hue="500", elevation=10, ) toolbar.left_action_items = [["arrow-left", lambda x: x]] toolbar.right_action_items = [["magnify", lambda x: self.show_confirmation_dialog()]] self.add_widget(toolbar)
def startmap(self, res, result): print(result['location']) mapview = "" for i in range(len(result['location'])): print(result['location'][i]['latitude']) if result['location'][i]['longitude'] and result['location'][i][ 'latitude']: if mapview == "": mapview = MapView(zoom=11, lat=result['location'][i]['latitude'], lon=result['location'][i]['longitude']) mapview.add_marker( MapMarkerPopup(lat=result['location'][i]['latitude'], lon=result['location'][i]['longitude'])) popup = Popup(content=mapview) popup.open()
def build(self): self.current_lat = 0 self.current_lon = 0 self.init_gps() self.start_gps() self.mapview = MapView(zoom=24, lat=self.current_lat, lon=self.current_lon) self.label = Label(text='Locations are supposed to be printed here.') self.layout = GridLayout(rows=2) self.layout.add_widget(self.mapview) self.layout.add_widget(self.label) return self.layout
class Principal(BoxLayout): meu_local = (-22.9035, -43.2096) mapa = MapView(zoom=15, lat=meu_local[0], lon=meu_local[1]) marcson = MapMarker(lat=meu_local[0], lon=meu_local[1]) def on_location(self, **kwargs): self.meu_local = (kwargs['lat'], kwargs['lon']) self.mapa.center_on(self.meu_local[0], self.meu_local[1]) self.marcson.lat = self.meu_local[0] self.marcson.lon = self.meu_local[1] self.mapa.add_marker(self.marcson) def start(self, tempo, distancia): gps.start(tempo, distancia) def marcar_onibus(self): from geopy.distance import vincenty url = 'http://dadosabertos.rio.rj.gov.br/apiTransporte/apresentacao/rest/index.cfm/obterTodasPosicoes' resposta = requests.get(url) dados = json.loads(resposta.text) for i in range(len(dados['DATA'])): distancia = vincenty( self.meu_local, (dados['DATA'][i][3], dados['DATA'][i][4])).meters if distancia < 2000: self.mapa.add_marker( MapMarker(lat=dados['DATA'][i][3], lon=dados['DATA'][i][4], source='bolinha.png')) def __init__(self, **kwargs): super(Principal, self).__init__(**kwargs) self.add_widget(self.mapa) if platform == 'android': try: gps.configure(on_location=self.on_location) except NotImplementedError: pass self.start(1000, 0) sleep(1.) self.marcar_onibus()
def build(self): self.itu_lat = 55.6593807 self.itu_lon = 12.5910774 self.obs_dic = None self.old_time = 0.0 self.weatherbox = AnchorLayout(anchor_x = 'center', anchor_y = 'bottom') self.Layout = RelativeLayout() self.mapview = MapView(zoom=11, lat=self.itu_lat, lon=self.itu_lon) mapview = self.mapview self.Layout.add_widget(mapview) # add map layer self.jsonmap = GeoJsonMapLayer(source='5_mile_airport.json') self.mapview.add_layer(self.jsonmap) self.overlay = AnchorLayout(anchor_x='right', anchor_y='top') lowerLeft = AnchorLayout(anchor_x='left', anchor_y='bottom') self.lowerLeftStack = StackLayout(orientation='lr-bt',size_hint=(0.15,0.15)) lowerLeft.add_widget(self.lowerLeftStack) btnre = Button(background_normal='refocus_normal.png', background_down='refocus_down.png', size_hint = (2,1)) btnre.bind(on_press=self.resetloc) btnnf = ToggleButton(background_normal='nofly_normal.png', background_down='nofly_down.png',size_hint = (2,1)) btnnf.bind(on_press=self.nofly) self.lowerLeftStack.add_widget(btnre) self.lowerLeftStack.add_widget(btnnf) btn = ToggleButton(background_normal='Settings B.png', background_down="Settings G.png") btn.bind(on_press= self.show_dropdown) self.settings = StackLayout(size_hint=(0.2,0.2)) self.settings.add_widget(btn) self.overlay.add_widget(self.settings) self.Layout.add_widget(lowerLeft) self.Layout.add_widget(self.overlay) marker = MapMarker(anchor_x = 0.5, anchor_y = 0.5, lat=self.itu_lat, lon=self.itu_lon) self.mapview.add_marker(marker) return self.Layout
def build(self): """In here, we build all the basic for our kivy stuff, like making our layout, initialize our mapview, our different buttons and so on, its also in here we call our gpsHandler, and call our placephotovogn""" self.logic = Logic(self) self.MenuFuncs = MenuFunctions(self) self.gpshandler = GpsHandler(self) self.offset = 0.001 """initalizing the few colors in kivy binary""" self.Lightred = [1111111111, 0, 0, 1] self.black = [0, 0, 0, 1] self.green = [0, 1111111, 0, 1] """Creating MapView, which let us determ, zoom, lat and lon, essentiel it would be pulling from gps signlas""" self.mapview = MapView(zoom=15, lat=56.04, lon=12.457) #56.0394 , 12.457 self.person = MapMarker(lat=self.mapview.lat, lon=self.mapview.lon, source='images/car.png') self.mapview.add_marker(self.person) """Making a layout, as a boxlayout, making it vertical to match our desired design""" self.layout = BoxLayout(orientation="vertical") """Initializing our buttons, then after connection them to functions, when they are pressed""" self.buttonAnmeld = Button(text="ANMELD!", font_size=100, color=self.black, background_color=self.green) self.buttonAlert = Button(text="ALARM!", font_size=200, color=self.black, background_color=self.Lightred, disabled=True, opacity=0) """Binding our botton to a specific function, lambda is so the function wont get called when iniialized""" self.buttonAnmeld.bind(on_press=lambda dt: self.logic.FotoVognSpotted( self.mapview.lat, self.mapview.lon)) """Creating the dropdown menu""" self.dropdown = DropDown(size_hint_x=0.2) """Labels""" labels = [ ' Reset Zoom', ' Zoom In', ' Zoom Out', ' Increase LAT', ' Decrease LAT', ' Increase LON', ' Decrease LON', " Exit" ] """Functions""" functions = [ self.MenuFuncs.resetZoom, self.MenuFuncs.zoomIn, self.MenuFuncs.zoomOut, self.MenuFuncs.IncreaseLat, self.MenuFuncs.DecreaseLat, self.MenuFuncs.IncreaseLon, self.MenuFuncs.DecreaseLon, self.MenuFuncs.exit ] """Creating buttons for each label, give them their corresponding function, allign them at left, and last, adding them to the dropdown widget""" for label, func in zip(labels, functions): self.btn = Button(text=label, size_hint_y=None, height=45, halign="left", valign="middle") self.btn.bind(size=self.btn.setter('text_size')) self.btn.bind(on_release=func) self.dropdown.add_widget(self.btn) """Creating our menuMainButton, also alligned at left""" self.mainbutton = Button(text=' Menu', size_hint_y=None, height=35, halign="left", valign="middle", size_hint_x=0.2) self.mainbutton.bind(size=self.mainbutton.setter('text_size')) self.mainbutton.bind(on_release=self.dropdown.open) """Adding all the different stuff to our layout, in the desired order""" self.layout.add_widget(self.mainbutton) self.layout.add_widget(self.buttonAnmeld) self.layout.add_widget(self.mapview) self.layout.add_widget(self.buttonAlert) self.logic.PlaceFotoVogn() self.gpshandler.run() """Returning the layout""" return self.layout
def build(self): mapview = MapView(zoom=11, lat=50.6394, lon=3.057) return mapview
def build(self): mapview = MapView(zoom=16, lat=lat, lon=lon) m1 = MapMarker(lon=lon, lat=lat) mapview.add_marker(m1) return mapview
def build(self): mapview = MapView(zoom=11, lat=40, lon=120) return mapview
# coding=utf-8 """ This example demonstrate how to use the MBTilesMapSource provider. It supports v1.1 version of .mbtiles of Mapbox. See more at http://mbtiles.org/ It currently require a Kivy version that can load data from a buffer. This is not the case on every platform at 1.8.1, but we're going to fix it. """ import sys from kivy.garden.mapview import MapView from kivy.garden.mapview.mbtsource import MBTilesMapSource from kivy.base import runTouchApp source = MBTilesMapSource(sys.argv[1]) runTouchApp( MapView(map_source=source, lat=source.default_lat, lon=source.default_lon, zoom=source.default_zoom))
def build(self): mapview = MapView(zoom=11, lat=-2.519495, lon=-44.247695) return mapview """return LoginScreen()"""
def build(self): mapview = MapView(zoom=11, lat=-22.6394, lon=-45.057) return mapview
def build(self): mapview = MapView(zoom=11, lat=g.latlng[0], lon=g.latlng[1]) return mapview
def __init__(self, **kwargs): super(CityHunterRoot, self).__init__(**kwargs) self.login_popup = LoginPopup() self.menu_popup = MenuPopup() self.map_widget = MapView(zoom=14, lon=50.6394, lat=3.057)
def build(self): mapa = MapView(zoom=11, lat=21.161908, lon=-86.851528) m1 = MapMarker(lat=21.161900, lon=-86.851528, source=img, anchor_x=0.5, anchor_y=0.5) mapa.add_marker(m1) return mapa