예제 #1
0
 def get_codes(self):
     # bbox = self.manager.get_screen('main').bbox
     bbox = self.manager.get_screen('bboxscreen').ids['mapbbox'].bbox
     print(bbox)
     inventario_path = self.manager.get_screen(
         'inventario').ids.filechooserscreen.selection[0]
     print(inventario_path)
     with open(inventario_path, encoding='utf8') as csvfile:
         data = csv.DictReader(csvfile)
         for row in data:
             if (float(row['Longitude']) > bbox[1]) and (float(
                     row['Longitude']) < bbox[3]) and (float(
                         row['Latitude']) > bbox[0]) and (float(
                             row['Latitude']) < bbox[2]):
                 print(row['Longitude'], row['Latitude'], row['Codigo'])
                 mark = MapMarker(lat=float(row['Latitude']),
                                  lon=float(row['Longitude']),
                                  source='marker.png')
                 self.manager.get_screen('main').ids['map'].add_marker(mark)
                 self.codes.append(int(row['Codigo']))
             else:
                 pass
     print(len(self.codes))
     self.manager.current = 'main'
     self.manager.transition.direction = 'up'
예제 #2
0
    def displayAll(self):
        ''' Simple function that displays all parking garages on file 
            Parameters: N/A
            Returns: None 
        '''
        #Get the list of garages, filter for only garage objects, and make sure it is not empty
        garageList = os.listdir("garages")
        for item in garageList:
            parts = item.split(".")
            if parts[-1] != "pkl":
                garageList.remove(item)
        if not garageList:
            pop = Popup(title="Error",
                        content=Label(text="No Garages on File"),
                        size_hint=(None, None),
                        size=(200, 200))
            pop.open()
            return

        #For each garage on file, mark its location
        coder = GoogleGeocoder("AIzaSyDPOAePgFbDCBU0rsOdvWX66C2CPUB2CZM")
        for item in garageList:
            item = os.path.join("garages", item)
            gar = pickle.load(open(item, "rb"))
            g = coder.get(gar.getLocation())
            coords = (g[0].geometry.location.lat, g[0].geometry.location.lng)
            m1 = MapMarker(lat=coords[0], lon=coords[1])
            self.ids.map1.add_marker(m1)
예제 #3
0
 def add_gps_dot(self, instance):
     lat_pos = self.google_map.lat
     lon_pos = self.google_map.lon
     responce = requests.get("http://dps.mybland.xyz/add_gps_dot.php?x=" +
                             str(lat_pos) + "&y=" + str(lon_pos))
     m1 = MapMarker(lat=float(lat_pos), lon=float(lon_pos))
     self.google_map.add_marker(m1)
     self.dots_obj.append(m1)
예제 #4
0
파일: main.py 프로젝트: mattos21/BusClub
 def tracking(self, *args):
     threading.Timer(5.0, self.tracking).start()
     self.layer.clear_widgets()
     self.layer.add_widget(
         MapMarker(lon=self.lon,
                   lat=self.lat,
                   source="bus.png",
                   on_release=self.on_release1))
     self.map.center_on(self.lat, self.lon)
예제 #5
0
 def create_marker(feature):
     global count
     geometry = feature["geometry"]
     if geometry["type"] != "Point":
         return
     lon, lat = geometry["coordinates"]
     marker = MapMarker(lon=lon, lat=lat)
     view.add_marker(marker)
     count += 1
예제 #6
0
파일: main.py 프로젝트: mattos21/BusClub
 def __init__(self, **kwargs):
     super(tela2, self).__init__(**kwargs)
     self.orientation = "vertical"
     gps.configure(on_location=self.on_location)
     gps.start()
     self.map = MapView(zoom=90, lat=self.lat, lon=self.lon)
     MapMarker(lon=self.lon,
               lat=self.lat,
               source="pessoa.png",
               on_press=self.on_press)
     self.add_widget(self.map)
     self.map.add_widget(self.layer)
     self.bind(lon=partial(self.tracking))
     time.sleep(1)
예제 #7
0
    def get_codes(self, selection, *args):
        print(selection[0])
        shp_path = selection[0]
        shp = shapefile.Reader(shp_path)
        print(shp)

        all_shapes = shp.shapes()
        all_records = shp.records()
        print(all_shapes)
        print(all_records)
        print(
            self.manager.get_screen(
                'inventario').ids.filechooserscreen.selection[0])
        for i in range(len(all_shapes)):
            boundary = all_shapes[i]
            boundary = shape(boundary)
            print(boundary)
            with open(self.manager.get_screen(
                    'inventario').ids.filechooserscreen.selection[0],
                      encoding='utf8') as csvfile:
                data = csv.DictReader(csvfile)
                for row in data:
                    if Point((float(row['Longitude']),
                              float(row['Latitude']))).within(boundary):
                        print('Dentro')
                        print(float(row['Latitude']), float(row['Longitude']),
                              int(row['Codigo']))
                        mark = MapMarker(lat=float(row['Latitude']),
                                         lon=float(row['Longitude']),
                                         source='marker.png')
                        self.manager.get_screen('main').ids['map'].add_marker(
                            mark)
                        self.codes.append(int(row['Codigo']))
                    else:
                        pass
        print(self.codes)
        self.manager.current = 'main'
        self.manager.transition.direction = "down"
예제 #8
0
    def mark(self, coords, info):
        ''' mark takes a garage and then marks its location on a map
            It also fills out the information on the screen for the garage

            Parameters: coords - coordinates of the nearest garage
                        info - parking garage object
            Returns: None
        '''

        if info == None:
            return

        #Add a marker to the screen and fill out information on the screen
        marker = MapMarker(lat=coords[0], lon=coords[1])
        self.ids.map2.add_marker(marker)
        self.ids.garage.text = str(info)

        #Display the pricing at the garage
        priceText = "Hour : Price"
        priceList = info.getPriceList()
        for item in priceList:
            priceText += "\n" + str(item) + " : " + str(priceList[item])
        self.ids.prices.text = priceText
예제 #9
0
    def displayRoute(self, destination):
        ''' 
            displayRoute aims to show the route that the user would have to take to get to the garage
        
            WORK IN PROGRESS
            Currently does get the directions and places a marker for each turn, 
            but does not properly show the route as intended.
            Decision to not implement this as it would prove distracting to the user in is current state.

            Parameter(s): destination - String that holds the address of the nearest parking garage
            Return(s): None
        '''
        #Get the directions to the address
        g = geocoder.ip("me")  #Get the location based on IP address
        coords = g.latlng  #Get the coordinates of my location
        directions = findDirections(coords, destination)
        if directions == None:
            print("No directions available")
            return

        #Mark each point
        for point in directions:
            mark = MapMarker(lat=point["lat"], lon=point["lng"])
            self.ids.map2.add_marker(mark)
예제 #10
0
 def teste(self):
     mark = MapMarker(lat=50, lon=10)
     self.manager.get_screen('main').ids['map'].add_marker(mark)
예제 #11
0
 def update_gps_dot(self, lat, lon):
     m1 = MapMarker(lat=float(lat), lon=float(lon))
     self.dots_obj.append(m1)
     self.google_map.add_marker(m1)