def geolocation(self):
        self.maplist = []
        self.buttonHeightCounter = .05
        API_KEY = 'AIzaSyBPGAbevdKkeXaZT0ZsR0qbO30Bpqqm0Mc'

        google_places = GooglePlaces(API_KEY)

        self.query_result = google_places.nearby_search(
            location=self.entry.get(),
            radius=700,
            types=[types.TYPE_RESTAURANT])
        self.current_places = self.query_result

        if self.query_result.has_attributions:
            print(self.query_result.html_attributions)

        for place in self.query_result.places:
            place.get_details()

            markers = "&markers=size:big|label:S|color:red|" + str(
                place.details['geometry']['location']['lat']) + "," + str(
                    place.details['geometry']['location']['lng']) + "|"
            self.maplist.append(markers)
            print(place.name)
            self.button_list.append(
                Button(self,
                       text=place.name,
                       command=lambda pname=place.name: self.on_click(pname),
                       width=25))
            self.button_list[-1].place(relx=.70,
                                       rely=self.buttonHeightCounter,
                                       anchor="c")
            self.buttonHeightCounter += .035
            print(place.formatted_address + "\n")

        google_maps = GoogleMaps(
            api_key='AIzaSyDlJqxwlOWWAPwf54ivrpAZw4R1Yb5j6Yk')

        location = google_maps.search(
            location=self.entry.get())  # sends search to Google Maps.

        my_location = location.first()  # returns only first location.

        #MARKER = '&markers=color:blue' + '%' + str(7) + 'Clabel:S%' + str(7) + 'C' + str(my_location.lat) + ',' + str(my_location.lng)
        #MARKER = "&markers=size:big|label:S|color:blue|" + str(my_location.lat) + "," + str(my_location.lng) + "|" + \

        MARKER = self.maplist[1] + self.maplist[2] + self.maplist[3]

        self.zoomlevel = ZOOM

        maptype_index = 0
        self.radiovar.set(maptype_index)

        self.goompy = GooMPy(WIDTH, HEIGHT, my_location.lat, my_location.lng,
                             ZOOM, MAPTYPE, MARKER)

        self.restart()
        print(self.query_result)
        print(str(my_location.lat))
        print(str(my_location.lng))
Exemple #2
0
    def __init__(self):
        tk.Tk.__init__(self)

        self.geometry(f'{WIDTH}x{HEIGHT}')
        self.title('GooMPy')

        self.canvas = tk.Canvas(self, width=WIDTH, height=HEIGHT)
        self.canvas.pack(fill='both')

        self.bind("<Key>", self.check_quit)
        self.bind('<B1-Motion>', self.drag)
        self.bind('<Button-1>', self.click)

        self.radiogroup = tk.Frame(self.canvas)
        self.radiovar = tk.IntVar()
        self.maptypes = ['roadmap', 'terrain', 'satellite', 'hybrid']
        self.add_radio_button(0)
        self.add_radio_button(1)
        self.add_radio_button(2)
        self.add_radio_button(3)

        self.zoom_in_button = self.add_zoom_button('+', +1)
        self.zoom_out_button = self.add_zoom_button('-', -1)

        self.zoomlevel = ZOOM
        self.radiovar.set(0)

        self.goompy = GooMPy(
            WIDTH, HEIGHT, LATITUDE, LONGITUDE, ZOOM, radius_meters=RADIUS)

        self.goompy.use_map_type(MAPTYPE)
        self.redraw()
def gps_update_map(x, y, image_plot):
    gps_map_coordinate = [x, y]
    gps_map_zoom = 19
    gps_map_type = 'satellite'
    gps_map_resolution = 1200
    gps_map = GooMPy(gps_map_resolution, gps_map_resolution,
                     gps_map_coordinate[0], gps_map_coordinate[1],
                     gps_map_zoom, gps_map_type)
    gps_map_tile = gps_map.bigimage
    gps_map_corner_upper_left = gps_map.northwest
    gps_map_corner_lower_right = gps_map.southeast
    gps_map_width = (gps_map_corner_lower_right[1] -
                     gps_map_corner_upper_left[1]) * 4 / 3
    gps_map_height = (gps_map_corner_upper_left[0] -
                      gps_map_corner_lower_right[0]) * 4 / 3
    gps_map_aspect_ratio = gps_map_width / gps_map_height
    gps_map_array = np.array(
        gps_map_tile.resize((int(gps_map_resolution * gps_map_aspect_ratio),
                             gps_map_resolution)))
    gps_map_array = np.swapaxes(gps_map_array[::-1, :], 0, 1)
    gps_map_effective_size = gps_map_height / gps_map_resolution
    image_plot.setScale(gps_map_effective_size)
    image_plot.setImage(gps_map_array)
    image_plot.setX(gps_map_corner_upper_left[1] - gps_map_width / 8)
    image_plot.setY(gps_map_corner_upper_left[0] - gps_map_height +
                    gps_map_height / 8)
    image_plot.update()
Exemple #4
0
def GetGPSPMAP(lat, long):
    ZOOM = 15
    MAPTYPE = 'roadmap'
    goompy = GooMPy(WIDTH, HEIGHT, lat, long, ZOOM, MAPTYPE)
    file_jpg = goompy.getFileName()
    print(file_jpg)
    return file_jpg
    def update_gps_map(self, use_map=None):
        if type(use_map) == str:
            map_file = np.load(use_map)
            gps_map_effective_size = map_file['scale']
            gps_map_array = map_file['map']
            gps_map_x_position = map_file['x']
            gps_map_y_position = map_file['y']
        elif type(use_map) == int:
            path = sys.argv[0][:-8]
            print path, path + 'maps/map' + str(use_map) + '.npz'
            map_file = np.load(path + 'maps/map' + str(use_map) + '.npz')
            gps_map_effective_size = map_file['scale']
            gps_map_array = map_file['map']
            gps_map_x_position = map_file['x']
            gps_map_y_position = map_file['y']
        elif 'phoenix' in self.gps_positions.keys():
            try:
                cur_pos_lon = self.gps_positions['phoenix']['pos'][0]
                cur_pos_lat = self.gps_positions['phoenix']['pos'][1]

                gps_map_coordinate = [cur_pos_lon, cur_pos_lat]
                gps_map_zoom = 19
                gps_map_type = 'satellite'
                gps_map_resolution = 1200
                gps_map = GooMPy(gps_map_resolution, gps_map_resolution,
                                 gps_map_coordinate[0], gps_map_coordinate[1],
                                 gps_map_zoom, gps_map_type)
                gps_map_tile = gps_map.bigimage
                gps_map_corner_upper_left = gps_map.northwest
                gps_map_corner_lower_right = gps_map.southeast
                gps_map_width = (gps_map_corner_lower_right[1] -
                                 gps_map_corner_upper_left[1]) * 4 / 3
                gps_map_height = (gps_map_corner_upper_left[0] -
                                  gps_map_corner_lower_right[0]) * 4 / 3
                gps_map_aspect_ratio = gps_map_width / gps_map_height
                gps_map_array = np.array(
                    gps_map_tile.resize(
                        (int(gps_map_resolution * gps_map_aspect_ratio),
                         gps_map_resolution)))
                gps_map_array = np.swapaxes(gps_map_array[::-1, :], 0, 1)
                gps_map_effective_size = gps_map_height / gps_map_resolution
                gps_map_x_position = gps_map_corner_upper_left[
                    1] - gps_map_width / 8
                gps_map_y_position = gps_map_corner_upper_left[
                    0] - gps_map_height + gps_map_height / 8
            except:
                pass
        else:
            return
        # update map from loaded data
        self.gps_background_image.setScale(gps_map_effective_size)
        self.gps_background_image.setImage(gps_map_array)
        self.gps_background_image.setX(gps_map_x_position)
        self.gps_background_image.setY(gps_map_y_position)
        self.gps_background_image.update()
class TestAU:
    ''' ----------------------- SYDNEY TEST (+LON, -LAT) ------------- '''
    test_set_au = {
        'LATITUDE': -33.8566,
        'LONGITUDE': 151.2153,
        'longitude_result': 151.2540,
        'latitude_result': -33.8839,
        'x_pixels': 581,
        'y_pixels': 446,
    }

    LONGITUDE = test_set_au.get('LONGITUDE')
    LATITUDE = test_set_au.get('LATITUDE')

    goompy = GooMPy(WIDTH,
                    HEIGHT,
                    LATITUDE,
                    LONGITUDE,
                    zoom,
                    MAPTYPE,
                    radius_meters=None)
    goompy.use_map_type(MAPTYPE)

    goompy.leftx = 1600
    goompy.uppery = 1600

    def test_get_lon_from_x_au(self):
        x_pixels = self.test_set_au.get('x_pixels')
        longitude_result = self.test_set_au.get('longitude_result')

        lon = self.goompy.get_lon_from_x(x_pixels)
        assert f'{lon:0.4f}' == f'{longitude_result:0.4f}'

    def test_get_lat_from_y_au(self):
        latitude_result = self.test_set_au.get('latitude_result')
        y_pixels = self.test_set_au.get('y_pixels')

        lat = self.goompy.get_lat_from_y(y_pixels)
        assert f'{lat:0.4f}' == f'{latitude_result:0.4f}'

    def test_get_x_from_lon_au(self):
        longitude_result = self.test_set_au.get('longitude_result')
        x_pixels_result = self.test_set_au.get('x_pixels') + self.goompy.leftx

        x = self.goompy.get_x_from_lon(longitude_result)
        assert abs(x - x_pixels_result) <= 1

    def test_get_y_from_lat_au(self):
        latitude_result = self.test_set_au.get('latitude_result')
        y_pixels_result = self.test_set_au.get('y_pixels') + self.goompy.uppery

        y = self.goompy.get_y_from_lat(latitude_result)
        assert abs(y - y_pixels_result) <= TEST_TOLERANCE
class TestNL:
    ''' ----------------------- AMSTERDAM TEST (+LON, +LAT) -------------- '''
    test_set_nl = {
        'LONGITUDE': 4.8994,
        'LATITUDE': 52.3755,
        'longitude_result': 4.8882,
        'latitude_result': 52.3774,
        'x_pixels': 60,
        'y_pixels': 246,
    }

    LONGITUDE = test_set_nl.get('LONGITUDE')
    LATITUDE = test_set_nl.get('LATITUDE')

    goompy = GooMPy(WIDTH,
                    HEIGHT,
                    LATITUDE,
                    LONGITUDE,
                    zoom,
                    MAPTYPE,
                    radius_meters=None)
    goompy.use_map_type(MAPTYPE)

    goompy.leftx = 960
    goompy.uppery = 960

    def test_get_lon_from_x_nl(self):
        x_pixels = self.test_set_nl.get('x_pixels')
        longitude_result = self.test_set_nl.get('longitude_result')

        lon = self.goompy.get_lon_from_x(x_pixels)
        assert f'{lon:0.4f}' == f'{longitude_result:0.4f}'

    def test_get_lat_from_y_nl(self):
        latitude_result = self.test_set_nl.get('latitude_result')
        y_pixels = self.test_set_nl.get('y_pixels')

        lat = self.goompy.get_lat_from_y(y_pixels)
        assert f'{lat:0.4f}' == f'{latitude_result:0.4f}'

    def test_get_x_from_lon_nl(self):
        longitude_result = self.test_set_nl.get('longitude_result')
        x_pixels_result = self.test_set_nl.get('x_pixels') + self.goompy.leftx

        x = self.goompy.get_x_from_lon(longitude_result)
        assert abs(x - x_pixels_result) <= 1

    def test_get_y_from_lat_nl(self):
        latitude_result = self.test_set_nl.get('latitude_result')
        y_pixels_result = self.test_set_nl.get('y_pixels') + self.goompy.uppery

        y = self.goompy.get_y_from_lat(latitude_result)
        assert abs(y - y_pixels_result) <= TEST_TOLERANCE
class TestAR:
    ''' ----------------------- BUENOS AIRES TEST (-LON, -LAT) ------------- '''
    test_set_ar = {
        'LATITUDE': -34.6246,
        'LONGITUDE': -58.4017,
        'longitude_result': -58.4515,
        'latitude_result': -34.6678,
        'x_pixels': 117,
        'y_pixels': 584,
    }

    LONGITUDE = test_set_ar.get('LONGITUDE')
    LATITUDE = test_set_ar.get('LATITUDE')

    goompy = GooMPy(WIDTH,
                    HEIGHT,
                    LATITUDE,
                    LONGITUDE,
                    zoom,
                    MAPTYPE,
                    radius_meters=None)
    goompy.use_map_type(MAPTYPE)

    goompy.leftx = 2
    goompy.uppery = 1919

    def test_get_lon_from_x_ar(self):
        x_pixels = self.test_set_ar.get('x_pixels')
        longitude_result = self.test_set_ar.get('longitude_result')

        lon = self.goompy.get_lon_from_x(x_pixels)
        assert f'{lon:0.4f}' == f'{longitude_result:0.4f}'

    def test_get_lat_from_y_ar(self):
        latitude_result = self.test_set_ar.get('latitude_result')
        y_pixels = self.test_set_ar.get('y_pixels')

        lat = self.goompy.get_lat_from_y(y_pixels)
        assert f'{lat:0.4f}' == f'{latitude_result:0.4f}'

    def test_get_x_from_lon_ar(self):
        longitude_result = self.test_set_ar.get('longitude_result')
        x_pixels_result = self.test_set_ar.get('x_pixels') + self.goompy.leftx

        x = self.goompy.get_x_from_lon(longitude_result)
        assert abs(x - x_pixels_result) <= 1

    def test_get_y_from_lat_ar(self):
        latitude_result = self.test_set_ar.get('latitude_result')
        y_pixels_result = self.test_set_ar.get('y_pixels') + self.goompy.uppery

        y = self.goompy.get_y_from_lat(latitude_result)
        assert abs(y - y_pixels_result) <= TEST_TOLERANCE
Exemple #9
0
def getMap():
    global mapCurr

    lat, lan = getLatLan()
    if not lat:
        lat = 0
        lan = 0

    goompy = GooMPy(mapW, mapH, lat, lan, 20, 'roadmap')
    image = goompy.getImage()

    mapCurr = pygame.image.fromstring(image.tobytes(), image.size, image.mode)
class TestUS:
    ''' ----------------------- NEW YORK TEST (-LON, +LAT) ------------- '''
    test_set_us = {
        'LONGITUDE': -74.012,
        'LATITUDE': 40.7044,
        'longitude_result': -74.0045,
        'latitude_result': 40.7097,
        'x_pixels': 495,
        'y_pixels': 156,
    }

    LONGITUDE = test_set_us.get('LONGITUDE')
    LATITUDE = test_set_us.get('LATITUDE')

    goompy = GooMPy(WIDTH,
                    HEIGHT,
                    LATITUDE,
                    LONGITUDE,
                    zoom,
                    MAPTYPE,
                    radius_meters=None)
    goompy.use_map_type(MAPTYPE)

    goompy.leftx = 960
    goompy.uppery = 960

    def test_get_lon_from_x_us(self):
        x_pixels = self.test_set_us.get('x_pixels')
        longitude_result = self.test_set_us.get('longitude_result')

        lon = self.goompy.get_lon_from_x(x_pixels)
        assert f'{lon:0.4f}' == f'{longitude_result:0.4f}'

    def test_get_lat_from_y_us(self):
        latitude_result = self.test_set_us.get('latitude_result')
        y_pixels = self.test_set_us.get('y_pixels')

        lat = self.goompy.get_lat_from_y(y_pixels)
        assert f'{lat:0.4f}' == f'{latitude_result:0.4f}'

    def test_get_x_from_lon_us(self):
        longitude_result = self.test_set_us.get('longitude_result')
        x_pixels_result = self.test_set_us.get('x_pixels') + self.goompy.leftx

        x = self.goompy.get_x_from_lon(longitude_result)
        assert abs(x - x_pixels_result) <= 1

    def test_get_y_from_lat_us(self):
        latitude_result = self.test_set_us.get('latitude_result')
        y_pixels_result = self.test_set_us.get('y_pixels') + self.goompy.uppery

        y = self.goompy.get_y_from_lat(latitude_result)
        assert abs(y - y_pixels_result) <= TEST_TOLERANCE
Exemple #11
0
    def __init__(self, root):
        self.root = root

        self.max_height = self.root.winfo_screenheight()
        self.max_width  = self.root.winfo_screenwidth()
        self.root.geometry((str(int(self.max_width/2))+"x"+str(int(self.max_height/2))))

##        self.radiogroup = Frame()

##        self.root.bind("<Key>", self.user_input)
##        self.root.bind("<Button>", self.user_input)
        self.root.bind("<Escape>", lambda e: self.root.destroy())
        
        # The user is able to select differnt modes of transportation
        # They are diffined here, as well as the mechanism for storing them
        self.transport_mode  = tk.StringVar()
        self.transport_mode.set("Walking")
        self.transport_modes = ["Walking", "Bicycling", "Driving", "Transit"] 

        # All the locations the user is using, stored in a list
        self.locations = []

        # The index used to calualate which locations are currently visable
        self.location_view = 0

        # Used to limit the system from attempting to display more locations
        # than possible
        self.VIEW_SIZE = 10

        # The coordinates of the current location of the user
        self.latitude  = float(
            location.CURRENT_LOCATION[:location.CURRENT_LOCATION.find(",")]
            )
        self.longitude = float(
            location.CURRENT_LOCATION[location.CURRENT_LOCATION.find(",")+1:]
            )

        # The zoom level on the map
        self.zoom = 15

        # The dimentions of the map
        self.map_width  = 500
        self.map_height = 500

        # GooMPy object to act as an API
        self.goompy = GooMPy(self.map_width, self.map_height, self.latitude, self.longitude, self.zoom, "roadmap")

        self.live = False

        # Starts the system
        self._draw_UI()
        self.root.mainloop()
Exemple #12
0
def getMap():
    global mapCurr

    mapOffline = pygame.image.load("icons/offline.jpg")

    lat, lan = getLatLan()
    if not lat:
        lat = 0
        lan = 0
    try:
        goompy = GooMPy(mapW, mapH, lat, lan, 20, 'roadmap')
        image = goompy.getImage()

        mapCurr = pygame.image.fromstring(image.tobytes(), image.size, image.mode)
    except Exception as e:
        mapCurr = mapOffline
Exemple #13
0
    def __init__(self):

        Tk.__init__(self)

        self.geometry('%dx%d+500+500' % (WIDTH, HEIGHT))
        self.title('GooMPy')

        self.canvas = Canvas(self, width=WIDTH, height=HEIGHT)

        self.canvas.pack()

        self.bind("<Key>", self.check_quit)
        self.bind('<B1-Motion>', self.drag)
        self.bind('<Button-1>', self.click)

        self.label = Label(self.canvas)

        self.radiogroup = Frame(self.canvas)
        self.radiovar = IntVar()
        self.maptypes = [
            'satellite', 'roadmap', 'terrain', 'roadmap2', 'roadsonly',
            'terrainonly', 'hybrid'
        ]
        self.add_radio_button('Satellite', 0)
        self.add_radio_button('Road Map', 1)
        self.add_radio_button('Terrain', 2)
        self.add_radio_button('Road Map 2', 3)
        self.add_radio_button('Roads Only', 4)
        self.add_radio_button('Terrain', 5)
        self.add_radio_button('Hybrid', 6)

        self.zoom_in_button = self.add_zoom_button('+', +1)
        self.zoom_out_button = self.add_zoom_button('-', -1)

        self.zoomlevel = ZOOM

        maptype_index = 0
        self.radiovar.set(maptype_index)

        self.goompy = GooMPy(WIDTH, HEIGHT, LATITUDE, LONGITUDE, ZOOM, MAPTYPE,
                             None, 4, 1, KMLFILE)

        self.restart()
Exemple #14
0
    def __init__(self, main_window):
        super(ReadUpdater, self).__init__()

        # ########## Reference to top level window ##########
        self.main_window = main_window  # type: QtWidgets.QMainWindow

        # ########## Get the settings instance ##########
        self.settings = QtCore.QSettings()

        # ########## Get the Pick And Plate instance of the logger ##########
        self.logger = logging.getLogger("RoverBaseStation")

        self.goompy = GooMPy(2 * WIDTH, HEIGHT, LATITUDE, LONGITUDE, ZOOM,
                             MAPTYPE, 1500)

        self.tab_widget = self.main_window.tabWidget  # type: QtWidgets.QTabWidget

        # ########## Some Flags ##########
        self.run_thread_flag = True

        # ########## Class variables ##########
        self.data_last_seen = time.time()
Exemple #15
0
def main():
    for zoom in range(START_ZOOM, END_ZOOM):
        goompy = GooMPy(WIDTH, HEIGHT, LATITUDE, LONGITUDE, zoom, MAPTYPE,
                        None, 4, 1, KMLFILE)
        goompy._KML2XY()
        goompy._fetch()
if __name__ == '__main__':
    test_set_ar = {
        'LATITUDE': -34.6246,
        'LONGITUDE': -58.4017,
        'longitude_result': -58.4589,
        'latitude_result': -34.6109,
        'x_pixels': 266,
        'y_pixels': 572,
    }

    print(test_set_ar)

    LONGITUDE = test_set_ar.get('LONGITUDE')
    LATITUDE = test_set_ar.get('LATITUDE')

    goompy = GooMPy(WIDTH,
                    HEIGHT,
                    LATITUDE,
                    LONGITUDE,
                    zoom,
                    MAPTYPE,
                    radius_meters=None)
    goompy.use_map_type(MAPTYPE)
    goompy.leftx = 0
    goompy.uppery = 572

    print(goompy.get_lon_from_x(test_set_ar.get('x_pixels')))
    print(goompy.get_lat_from_y(test_set_ar.get('y_pixels')))
    print(goompy.get_x_from_lon(test_set_ar.get('longitude_result')))
    print(goompy.get_y_from_lat(test_set_ar.get('latitude_result')))
    def create_tabPages(self, tag, tabPage):
        if tag == 'parse':
            self.tree_parseDate = ttk.Treeview(tabPage, selectmode='browse')
            verticalScroll = ttk.Scrollbar(tabPage,
                                           orient='vertical',
                                           command=self.tree_parseDate.yview)
            verticalScroll.pack(side='right', fill='y')
            horScroll = ttk.Scrollbar(tabPage,
                                      orient='horizontal',
                                      command=self.tree_parseDate.xview)
            horScroll.pack(side='bottom', fill='x')

            self.tree_parseDate.configure(yscrollcommand=verticalScroll.set)
            self.tree_parseDate.configure(xscrollcommand=horScroll.set)

            self.tree_parseDate['columns'] = ('latitude', 'longhitude',
                                              'altitude', 'distance',
                                              'satellites', 'quality', 'speed',
                                              'course', 'date')
            #self.tree_parseDate['show'] = 'headings'
            self.tree_parseDate.heading("#0", text='Timestamp', anchor='w')
            self.tree_parseDate.column("#0", anchor="w", width=40)
            self.tree_parseDate.heading('latitude', text='Latitude')
            self.tree_parseDate.column('latitude',
                                       stretch='yes',
                                       anchor='w',
                                       width=14)

            self.tree_parseDate.heading('longhitude', text='Longhitude')
            self.tree_parseDate.column('longhitude', anchor='w', width=20)

            self.tree_parseDate.heading('altitude', text='Altitude')
            self.tree_parseDate.column('altitude', anchor='w', width=20)

            self.tree_parseDate.heading('distance', text='Distance')
            self.tree_parseDate.column('distance', anchor='w', width=20)

            self.tree_parseDate.heading('satellites', text='Satellites')
            self.tree_parseDate.column('satellites', anchor='w', width=10)

            self.tree_parseDate.heading('quality', text='Quality')
            self.tree_parseDate.column('quality', anchor='w', width=20)

            self.tree_parseDate.heading('speed', text='Speed')
            self.tree_parseDate.column('speed', anchor='w', width=20)

            self.tree_parseDate.heading('course', text='Course')
            self.tree_parseDate.column('course', anchor='w', width=20)

            self.tree_parseDate.heading('date', text='Date')
            self.tree_parseDate.column('date', anchor='w', width=20)

            #self.init_workspaces()
            self.tree_parseDate.pack(expand=1, fill='both')
        elif tag == 'raw':
            self.txt_rawData = Text(tabPage)
            self.txt_rawData.pack(expand=1, fill='both')
            self.txt_rawData.insert(END, 'GPS Logger started...')
            pass
        elif tag == 'summary':
            pass
        else:
            self.canvas = Canvas(tabPage)
            self.canvas.pack(expand=1, fill='both')
            self.label = Label(self.canvas)
            self.label.bind('<B1-Motion>', self.goompy_drag)
            self.label.bind('<Button-1>', self.goompy_click)
            self.label.bind("<Double-1>", lambda e: self.goompy_zoom(+1))
            self.label.bind("<Double-3>", lambda e: self.goompy_zoom(-1))
            self.label.bind_all("<MouseWheel>", self.goompy_mousewheel)
            self.zoomlevel = ZOOM
            self.goompy = GooMPy(WIDTH, HEIGHT, LATITUDE, LONGITUDE, ZOOM,
                                 MAPTYPE)
            self.goompy_restart()
            pass
        pass
    def __init__(self):

        Tk.__init__(self)

        self.geometry('%dx%d+100+100' % (1200, 600))
        self.title('Crowdtour')
        self.audioCount = 0
        self.WAVE_OUTPUT_FILENAME = ''
        self.button_list = []
        self.current_places = []

        app = QApplication(sys.argv)

        self.canvas = Canvas(self, width=WIDTH, height=HEIGHT)

        self.canvas.pack()
        self.canvas.place(relx=0, rely=0)
        self.bind("<Key>", self.check_quit)
        self.bind('<B1-Motion>', self.drag)
        self.bind('<Button-1>', self.click)

        self.label = Label(self.canvas)

        self.radiogroup = Frame(self.canvas)
        self.radiovar = IntVar()
        self.maptypes = ['roadmap', 'terrain', 'satellite', 'hybrid']
        self.add_radio_button('Road Map', 0)
        self.add_radio_button('Terrain', 1)
        self.add_radio_button('Satellite', 2)
        self.add_radio_button('Hybrid', 3)

        #input
        self.entry = Entry(self, bd=3)
        self.button = Button(self, text="Location", command=self.geolocation)
        self.button.place(relx=.18, rely=.90, anchor="c")
        self.entry.place(relx=.05, rely=.80)

        #buttons
        self.recordButton = Button(self, text="Record", command=self.record)
        self.recordButton.place(relx=.30, rely=.75, anchor="c")

        self.uploadButton = Button(self, text="Upload", command=self.upload)
        self.uploadButton.place(relx=.30, rely=.80, anchor="c")

        self.playButton = Button(self, text="Play", command=self.play)
        self.playButton.place(relx=.30, rely=.85, anchor="c")

        self.deleteButton = Button(self, text="Delete", command=self.delete)
        self.deleteButton.place(relx=.30, rely=.90, anchor="c")
        ### adding part here ###
        self.sound = QSoundEffect()
        # This is where you set default sound source
        if not os.path.exists('sounds'):
            os.makedirs('sounds')

        defaultBytes = b'27\xe5\xb2\x81\xe5'
        waveTest = wave.open(os.path.join('sounds', 'DefaultSound.wav'), 'w')
        waveTest.setparams((2, 2, 44100, 440320, 'NONE', 'not compressed'))
        waveTest.writeframes(defaultBytes)

        self.sound.setSource(
            QUrl.fromLocalFile(os.path.join('sounds', 'DefaultSound.wav')))

        ### adding part here ###

        self.zoom_in_button = self.add_zoom_button('+', +1)
        self.zoom_out_button = self.add_zoom_button('-', -1)

        self.zoomlevel = ZOOM

        maptype_index = 0
        self.radiovar.set(maptype_index)
        MARKER = "markers=size:tiny|label:B|color:blue|" + str(
            LATITUDE) + "," + str(LONGITUDE)
        self.goompy = GooMPy(WIDTH, HEIGHT, LATITUDE, LONGITUDE, ZOOM, MAPTYPE,
                             MARKER)

        self.restart()