Example #1
0
def markers_direction():
    figure_layout = {
        'width': '1600px',
        'height': '1100px',
        'border': '1px solid black',
        'padding': '1px'
    }

    switzerland_ctr_coord = config['switzerland_ctr']
    gmaps.configure(api_key=config['api_key'])
    fig = gmaps.figure(layout=figure_layout,
                       center=switzerland_ctr_coord,
                       zoom_level=9)

    winterthur_lat, winterthur_lon = map.city_lat_lon('Winterthur')
    zurich_lat, zurich_lon = map.city_lat_lon('Zurich')
    winterthur_point = map.city_point('Winterthur')
    zurich_point = map.city_point('Zurich')

    locations = [(winterthur_lat, winterthur_lon), (zurich_lat, zurich_lon)]
    fig = map.add_marker(fig, locations)
    fig = map.add_direction(fig,
                            winterthur_point,
                            zurich_point,
                            mode='DRIVING')
Example #2
0
def make_the_base_map():
    # set constants
    main_path = 'data'
    global api_key
    api_key = open(main_path + '/config.py', 'r')
    api_key = api_key.read().replace('api_key = ',
            '').replace('“','').replace('”','')
    gmaps.configure(api_key=api_key) # Your Google API key

    # get information
    df = pd.read_csv(main_path + '/nyc_blk_map_with_vals_for_front_end_FILTERED.csv')
    with open(main_path + '/BoroughBoundaries.geojson') as f:
        geometry = json.load(f)
    global nbhd_map
    nbhd_map = gpd.read_file(main_path + '/nyc_nbhd_map.shp')

    # Control the display
    global new_york_coordinates
    new_york_coordinates = (40.75, -73.9)
    heatmap_gradient = [
        (250, 185, 123, 0),
        'yellow',
        (249, 127, 77, 1),
        'red',
    ]

    # define layers
    global geojson_layer
    global heatmap_layer
    geojson_layer = gmaps.geojson_layer(geometry, fill_color=(0,0,0,0), 
            fill_opacity=1, stroke_weight=0.5)
    heatmap_layer = gmaps.heatmap_layer(df[['latitude', 'longitude']], 
            weights=df['magnitude'], max_intensity=10, 
            point_radius=0.00075, opacity=1, gradient=heatmap_gradient,
            dissipating=False)
Example #3
0
    def plot_base_map(self, place='switzerland'):
        '''
        Create base map of switzerland

        arguments:
        ----------
        none 

        return:
        -------
        fig - gmaps figure 
        '''
        figure_layout = {
            'width': '1600px',
            'height': '1100px',
            'border': '1px solid black',
            'padding': '1px'
        }

        if place == 'switzerland':
            center_coords = self._config['switzerland_ctr']
        else:
            center_coords = self._config['winterthur_ctr']

        gmaps.configure(api_key=self._config['api_key'])
        fig = gmaps.figure(layout=figure_layout,
                           center=center_coords,
                           zoom_level=9)

        return fig
Example #4
0
def get_lat_lng(apiKey, address):  #2 farklı fonksiyon belirliyoruz.
    global output_address
    url = (
        'https://maps.googleapis.com/maps/api/geocode/json?address={}&key={}'.
        format(address.replace(' ', '+'), apiKey)
    )  #Sonucu bir yere getirmek için json formatında bir url kullanıyoruz.
    try:
        response = requests.get(
            url
        )  #url deki değerleri en baştaki requests kütüphanesi sayesinde sorguluyoruz./#We query values ​​in url with the requests library at the very beginning.
        resp_json_payload = response.json(
        )  #Hatırlarsanız URL miz json formatındaydı.önceki koddaki sorgudan çekdiğimiz değeri json olarak ayarlıyoruz. #If you remember, our URL was in json format. We set the value we got from the query in the previous code to json.
        output_address = resp_json_payload["results"][0]["formatted_address"]
        lat = resp_json_payload['results'][0]['geometry']['location'][
            'lat']  #Burda lokasyonumuzun geometrik değerlerini lat türünden alıyoruz.
        lng = resp_json_payload['results'][0]['geometry']['location'][
            'lng']  #Burda lokasyonumuzun geometrik değerlerini lng türünden alıyoruz.
        gmaps.configure(api_key=apiKey)
        location = (lat, lng
                    )  #lat ve lng değerlerini lokasyon değerine aktarıyoruz.
        fig = gmaps.figure(
            center=location, zoom_level=15
        )  #orta merkezi lokasyon olarak seçiyoruz ve yakınlaştırmayı 15 yapıyoruz ki daha dinamik olsun.

    except:  #Bir hatamız olursa diye bir dönüt yazıyoruz.
        print('HATA: Lokasyon bulunamadı.'.format(address))
        lat = 0
        lng = 0
    return lat, lng, output_address, fig
Example #5
0
def PlotMap():
    # Fucntion to create basemap
    global count
    global community

    gmaps.configure('AIzaSyBwEyjaABv6E1VJK3P_GKmMrvCIs8QEBJI')
    # =============================================================================
    #     m  = Basemap(projection='mill',llcrnrlon=min(count['lon']),llcrnrlat=min(count['lat']),urcrnrlat=max(count['lat']),urcrnrlon=max(count['lon']))
    #     m.drawstates()
    #     m.drawcoastlines()
    #     m.drawcounties()
    # =============================================================================

    #Plotting the data
    # =============================================================================
    #     lon=np.array(count['lon'])
    #     lat=np.array(count['lat'])
    #     data=np.array(count['english'])
    #     x,y = m(lon,lat)
    #     m.scatter(x,y,data)
    # =============================================================================
    # =============================================================================
    #     data = [(float(count.iloc[i]['lat']), float(count.iloc[i]['lon'])) for i in range(len(count))]
    #     print(data)
    #     gmaps.heatmap(data)
    # =============================================================================
    locations = count[['lat', 'lon']]
    weight = count['english']
    fig = gmaps.figure()
    fig.add_layer(gmaps.heatmap_layer(locations, weights=weight))
    embed_minimal_html('export.html', views=[fig])
    return fig
Example #6
0
    def get(self, request, format=None):
        """Get route for Dirtiness map."""
        gmaps.configure(api_key=os.environ.get('MAPS_API'))

        locations = []
        for each in Dirtiness.objects.all():
            temp = []
            if each.latitude and each.longitude:
                temp.append(each.latitude)
                temp.append(each.longitude)
                locations.append(temp)

        heatmap_layer = gmaps.heatmap_layer(locations)

        heatmap_layer.gradient = [(0, 0, 0, 0.7), (255, 178, 102, 0.4),
                                  (102, 51, 0, 0.8)]

        fig = gmaps.figure()

        fig.add_layer(heatmap_layer)
        embed_minimal_html('export.html', views=[fig])

        export = open('export.html').read()

        return Response(export)
Example #7
0
    def get(self, request, format=None):
        """Get route for entertainment map."""
        gmaps.configure(api_key=os.environ.get('MAPS_API'))

        locations = []
        for each in Entertainment.objects.all():
            temp = []
            p = re.compile('[()°,]')  # I know this is bad regex
            split_location = p.sub('', str(each.location)).split()
            try:
                if split_location[0] != 'None' or split_location[1] != 'None':
                    temp.append(float(split_location[0]))
                    temp.append(float(split_location[1]))
                    locations.append(temp)
            except IndexError:
                pass

        heatmap_layer = gmaps.heatmap_layer(locations)

        heatmap_layer.gradient = [(0, 0, 0, 0.7), (255, 178, 102, 0.4),
                                  (255, 128, 0, 0.8)]

        fig = gmaps.figure()

        fig.add_layer(heatmap_layer)
        embed_minimal_html('export.html', views=[fig])

        export = open('export.html').read()

        return Response(export)
Example #8
0
def googleMaps(dataset):
    ownAPIKey= 'go_get_it_from_google_maps_api'
    gmaps.configure(api_key=ownAPIKey)
    
    # create the info box template
    info_box_template = """
    <dl>
    <dt>Name</dt><dd>{name}</dd>
    <dt>ID</dt><dd>{id}</dd>
    <dt>Score</dt><dd>{score}</dd>
    <dt>Location</dt><dd>{location}</dd>
    <dt>Availability (%)</dt><dd>{available}</dd>
    <dt>URL</dt><dd>{listing_url}</dd>
    </dl>
    """
    dataset.drop(columns=['description'], inplace=True) # drop description as it is too long
    
    gmap_dict= dataset.to_dict('records') # convert each row into a dictionary of the list
    
    gmap_locations =dataset['location'].to_list() # to show the markers on the map
    
    gmap_info = [info_box_template.format(**id) for id in gmap_dict] #map the gmap_dict with the info box template
    
    marker_layer = gmaps.marker_layer(gmap_locations, info_box_content=gmap_info) # create the markers to be shown on google map
    
    fig = gmaps.figure()
    fig.add_layer(marker_layer) # combine with the current map
    embed_minimal_html('map.html', views=[fig])
Example #9
0
    def get(self, request, format=None):
        """Get route for crime map."""
        gmaps.configure(api_key=os.environ.get('MAPS_API'))

        locations = []
        for each in Crimes.objects.all():
            temp = []
            temp.append(each.latitude)
            temp.append(each.longitude)
            locations.append(temp)

        try:
            heatmap_layer = gmaps.heatmap_layer(locations)
        except TraitError:
            heatmap_layer = gmaps.heatmap_layer(
                [[47.465568160532435, -122.50131030799446]])

        heatmap_layer.gradient = [(0, 0, 0, 0.7), (255, 105, 180, 0.4),
                                  (255, 0, 0, 0.8)]

        fig = gmaps.figure()

        fig.add_layer(heatmap_layer)
        embed_minimal_html('export.html', views=[fig])

        export = open('export.html').read()

        return Response(export)
Example #10
0
def show_google_map(paths, API_key, region):

    lines = []
    for f in pbar()(paths.fragments):
        flines = []
        for l in f:
            line_coords = np.r_[list(l.coords.xy)].T
            for i in range(len(line_coords) - 1):
                flines.append(
                    gmaps.Line(start=tuple(line_coords[i][::-1]),
                               end=tuple(line_coords[i + 1][::-1])))
        lines.append(flines)
    lines = flatten(lines)
    print "found", len(lines), "line segments"

    markers = []

    for o, f in pbar()(zip(flatten(paths.resampled_orientations),
                           flatten(paths.resampled_fragments))):
        coords = np.r_[list(f.xy)].T
        markers.append([
            gmaps.Marker((coords[i][1], coords[i][0]),
                         info_box_content=str(o[i]))
            for i in range(len(coords))
        ])
    markers = flatten(markers)
    print "found", len(markers), "sampling locations"

    gmaps.configure(api_key=API_key)
    gmap_b = gmaps.Polygon([(i[1], i[0]) for i in region])
    fig = gmaps.figure(center=tuple(region.mean(axis=0)[::-1]), zoom_level=16)
    fig.add_layer(gmaps.drawing_layer(features=[gmap_b] + lines + markers))
    return fig
Example #11
0
    def __init__(self, api_key, df, categories:list, max_intensity:int=800, point_radius:int=5):
        """
        Jupyter widget for exploring KFC and Starbucks outlets

        Using checkboxes, the user chooses whether to include
        Starbucks, KFC outlets, both or neither.
        """
        gmaps.configure(api_key=api_key)

        if type(categories) == str:
            categories = [categories]
        self.max_intensity = max_intensity
        self.point_radius = point_radius
        self._df = df
        self._categories = categories
        self._catoptions = {cat: list(set(self._df.loc[:, cat])) for cat in categories}
        self._checkboxes = None
        self._mislider = None
        self._prslider = None
        self.heatmap = None


        title_widget = widgets.HTML(
            '<h3>Explore GPX and TCX data</h3>'
        )
        boxes = self._render_controls()
        map_figure = self._render_map()

        self._container = widgets.VBox(
            [title_widget, *boxes, map_figure])
Example #12
0
def app_1():

    lat = request.form['latitude']
    long = request.form['longitude']
    userPos = [float(lat), float(long)]

    import gmaps

    import pandas as pd
    from IPython.display import IFrame
    import numpy as np
    from scipy import spatial
    import gmplot
    import certifi
    import ssl
    import geopy.geocoders
    from geopy.geocoders import Nominatim

    c = crash[['lat', 'long']]
    c = np.array(c)

    coord = '{0},{1}'.format(userPos[0], userPos[1])

    ctx = ssl.create_default_context(cafile=certifi.where())
    geopy.geocoders.options.default_ssl_context = ctx

    geolocator = Nominatim(scheme='http')
    location = geolocator.reverse(coord)
    print(userPos, location)

    kdtree = spatial.KDTree(c)
    n = kdtree.query_ball_point(userPos, 0.1)

    from sklearn.cluster import KMeans
    import gmplot
    from IPython.display import IFrame
    from geopy.geocoders import Nominatim

    geolocator = Nominatim()
    K = 10
    location = []
    kmeans = KMeans(n_clusters=K, random_state=0).fit(c[n])
    cluster = kmeans.cluster_centers_

    for i in range(K):
        coord = '{0},{1}'.format(cluster[i][0], cluster[i][1])
        loc = geolocator.reverse(coord)
        print(loc, coord)
        location.append(loc)

    gmap = gmplot.GoogleMapPlotter(userPos[0], userPos[1], 13)
    gmap.apikey = "AIzaSyDaomlNTiEXSBRpeDZWw4qS2zbZSWsMnEA"
    gmaps.configure(api_key="AIzaSyDaomlNTiEXSBRpeDZWw4qS2zbZSWsMnEA")
    gmap.scatter(cluster[:, 0], cluster[:, 1], 'red', size=150, marker=False)

    gmap.draw('map3.html')
    return send_file("map3.html")
Example #13
0
def myfunpro(po):             #argument:dataframe(df)
    lat_list = list(po["latitude"])
    long_list = list(po["longitude"])
    gmaps.configure(api_key="AIzaSyDmXhcX8z4d4GxPxIiklwNvtqxcjZoWsWU")
    fig = gmaps.figure()
    var1 = json.dumps(
        [{'lat': country, 'lng': wins} for country, wins in zip(lat_list, long_list)]
    )
    return var1
Example #14
0
def create_map(pairs, key):
    new_york_coordinates = (40.75, -74.00)
    gmaps.configure(api_key=key)
    fig = gmaps.figure(center=new_york_coordinates, zoom_level=11)
    heatmap_layer = gmaps.heatmap_layer(pairs)
    heatmap_layer.max_intensity = 1
    heatmap_layer.point_radius = 15
    fig.add_layer(heatmap_layer)
    return fig
Example #15
0
def get_traffic_html():
    gmaps.configure(api_key=config.google_config['API_key'])

    # Map centered on London
    fig = gmaps.figure(center=(51.5, -0.2), zoom_level=11)
    # fig.add_layer(gmaps.bicycling_layer())
    fig.add_layer(gmaps.traffic_layer())
    print(help(fig))
    # embed_minimal_html('export.html', views=[fig])
    return None
Example #16
0
def maps_view(request, pk):
    device_data = Data.objects.get(pk=pk)
    latfloat = float(device_data.latitude)
    longfloat = float(device_data.longitude)

    gmaps.configure(api_key='AIzaSyAH6Tx3JJQvAkt4Tbw3tBWiSO8bLFrN41w')
    new_york_coordinates = (latfloat, longfloat)
    gmaps.figure(center=new_york_coordinates, zoom_level=12)

    return render(request, 'mapsview.html')
Example #17
0
def app_6():
    geolocator = Nominatim()

    gmap = gmplot.GoogleMapPlotter(42.3301, -71.0589, 12.9)
    gmap.scatter(crash['lat'], crash['long'], '#ff0000', size=10, marker=False)
    gmaps.configure(api_key="AIzaSyDaomlNTiEXSBRpeDZWw4qS2zbZSWsMnEA")
    gmap.apikey = "AIzaSyDaomlNTiEXSBRpeDZWw4qS2zbZSWsMnEA"
    gmap.heatmap(crash['lat'], crash['long'])
    gmap.draw('map.html')
    IFrame('map.html', width=800, height=600)
    return send_file("map.html")
Example #18
0
def myfun1(po):             #argument:dataframe(df)
    lat_list = list(po["latitude"])
    long_list = list(po["longitude"])
    gmaps.configure(api_key="AIzaSyDmXhcX8z4d4GxPxIiklwNvtqxcjZoWsWU")
    fig = gmaps.figure()
    var1 = json.dumps(
        [{'lat': country, 'lng': wins} for country, wins in zip(lat_list, long_list)]
    )
    markers = gmaps.marker_layer(list(zip(lat_list, long_list)))
    fig.add_layer(markers)
    data1 = embed_snippet(views=[fig])
    return data1,var1
def plot_price_heatmap(df):
    APIKEY = os.getenv('GMAPAPIKEY')
    gmaps.configure(api_key=APIKEY)
    fig = gmaps.figure()
    df['location'] = df.apply(lambda x: (x['latitude'], x['longitude']), axis=1)
    locations = df['location']
    weights = df['price'].values
    #locations = (df['latitude'], df['longitude'])
    heatmap_layer = gmaps.heatmap_layer(locations, weights=weights)
    heatmap_layer.max_intensity = 2000
    heatmap_layer.point_radius = 30
    fig.add_layer(heatmap_layer)
    fig.savefig('../visualizations/price_heatmap.png')
    def __init__(self, show=False):
        """Initiator.

        :arg show: (bool) show or not the images
        """
        self.key = settings.google_key
        self.show = show
        self.size = "600x300"
        self.zoom = "16"
        self.roadmap = "roadmap"
        self.base_url = "https://maps.googleapis.com/maps/api/staticmap?"
        self.url = "{base_url}center={lat}+{lng}&zoom={zoom}&size={size}&maptype={roadmap}&key={key}"
        gmaps.configure(api_key=self.key)
Example #21
0
def fun(request):

	gmaps.configure(api_key = 'AIzaSyBcT_KzlYcyYf-171L7pR6ngBgZHYq24C4')
	dataset = gmaps.datasets.load_dataset_as_df('earthquakes')
	dataset.head()
	location = dataset[['latitude','longitude']]
	weight = dataset['magnitude']
	fig = gmaps.figure()
	fig.add_layer(gmaps.heatmap_layer(location,weights = weight))
	fig = gmaps.figure(map_type='ROADMAP')
	# 'ROADMAP', 'HYBRID', 'TERRAIN', 'SATELLITE'

	return render(request,'index.html',{'fig':fig})
Example #22
0
def map_tweets(tweets, keyword):
coords = []
for tweet in tweets:
    if keyword is in tweet["text"]:
        coords.append(tweet["geo"])
return coords

coords = map_tweets(tweets, "weed")

gmaps.configure(api_key="AIzaSyADv13vyns8lTpdjwoxMwYL3Q0k2Eqoyno")
locations = coord
fig = gmaps.figure()
fig.add_layer(gmaps.heatmap_layer(locations))
fig
Example #23
0
def heatmap(api, csv_file, product_list):
    """Creates a heatmap with prices data from one petrol product
    """
    gmaps.configure(api_key=api)
    df = pd.read_csv('bonarea_gasolineras_prices.csv')
    normalized_price = (df[product_list] - df[product_list].min()) / (
        df[product_list].max() - df[product_list].min())
    spain_coordinates = (41.8, -0.041509)
    fig = gmaps.figure(center=spain_coordinates, zoom_level=7)
    heatmap_layer = gmaps.heatmap_layer(df[['latitude', 'longitude']],
                                        weights=normalized_price,
                                        max_intensity=0,
                                        point_radius=20.0)
    fig.add_layer(heatmap_layer)
    return fig
Example #24
0
def find_path(start, end, method = 'BICYCLING'):
    "Method could be 'DRIVING','WALKING','BICYCLING','TRANSIT'"
    my_key = api_key
    gmaps.configure(api_key=my_key)
    
    start = str(start)
    end = str(end)
    start_location = get_location(start)
    end_location = get_location(end)
    
    fig = gmaps.figure()
    path = gmaps.directions_layer(start_location, end_location, travel_mode= method)#we can add waypoints and travel_mode
    fig.add_layer(path)

    return fig
Example #25
0
def gmaps_plot(df_results, color_array):
    # Read api_key from txt file
    with open('gmaps_apikey.txt', 'a') as f:
        api_key = f.readline()

    gmaps.configure(api_key=api_key)
    #Set up your map
    fig = gmaps.figure()
    colors = list(df_results['color'].values)
    locations = list(zip(df_results['INTPTLAT'], df_results['INTPTLONG']))
    symbols = gmaps.symbol_layer(locations,
                                 fill_color=colors,
                                 stroke_color=colors,
                                 scale=2)
    fig.add_layer(symbols)
    fig.show()
Example #26
0
def generate_heatmap(flair_list):
    comments_coords_list = []
    mapping_dict = load_instituation_coords()

    for institution in flair_list:
        if mapping_dict.get(institution):
            comments_coords_list.append(mapping_dict[institution])

    gmaps.configure(api_key=GOOGLE_MAPS_API_KEY)
    m = gmaps.Map()
    heatmap_layer = gmaps.Heatmap(data=comments_coords_list)
    heatmap_layer.max_intensity = 80
    heatmap_layer.point_radius = 40
    m.add_layer(heatmap_layer)

    return m
Example #27
0
def get_data_points_figure(data):
    gmaps.configure(api_key=get_api_key())
    figure_layout = {'height': '500px', 'margin': '0 auto 0 auto'}
    fig = gmaps.figure(map_type="ROADMAP",
                       zoom_level=2,
                       center=(30, 31),
                       layout=figure_layout)
    heatmap_layer = gmaps.heatmap_layer(data)
    heatmap_layer.max_intensity = 100
    heatmap_layer.point_radius = 1
    heatmap_layer.dissipating = False

    # ToDo: consider using gmaps.symbol_layer with small markers

    fig.add_layer(heatmap_layer)
    return fig
Example #28
0
def Proxy(login, passw, API_KEY, zoom, scale, coor):

    login = config.login
    passw = config.passw
    API_KEY = config.API_KEY

    http = "http://" + login + ":" + passw + "@proxy.dst.local:8080"
    https = "https://" + login + ":" + passw + "@proxy.dst.local:8080"

    proxies = {"http": http, "https": https}
    gmaps.configure(api_key=API_KEY)

    url = "https://maps.googleapis.com/maps/api/staticmap?center=" + coor + "&zoom=" + str(
        zoom) + "&size=640x640&maptype=satellite&scale=" + str(
            scale) + "&key=" + API_KEY

    return proxies, url
Example #29
0
def initiate_gmaps(key_path):
    """Performs authentication for using the Google Maps API.
    
    Parameters
    ----------
    key_path : string
        String containing the absolute path to the api key.

    """
    try:
        with open(key_path) as f:
            api_key = f.readline()
            f.close()
        gmaps.configure(api_key=api_key)
        print("Successfully authenticated the API key.")
    except:
        print("Failed to authenticate the API key.")
Example #30
0
def get_gmap_figure(LAT, LON, filename = 'apikey.txt'):

    # Reference: https://jupyter-gmaps.readthedocs.io/en/latest/tutorial.html#basic-concepts

    # read google maps API
    with open(filename) as f:
        my_api_key = f.readline()
        f.close

    # get the base map
    gmaps.configure(api_key=my_api_key) # Fill in with your API key

    # zoom the map around the center
    center_of_all_sensors = (np.mean(LAT),np.mean(LON))

    # set the figure properties
    figure_layout = {
        'width': '600px',
        'height': '600px',
        'border': '1px solid black',
        'padding': '1px',
        'margin': '0 auto 0 auto'
    }

    # plot the base map
    fobj = gmaps.figure(center=center_of_all_sensors, layout=figure_layout, zoom_level=13, map_type='TERRAIN')

    # Note:
    #'ROADMAP' is the default Google Maps style,
    #'SATELLITE' is a simple satellite view,
    #'HYBRID' is a satellite view with common features, such as roads and cities, overlaid,
    #'TERRAIN' is a map that emphasizes terrain features.

    # add point locations on top of the base map
    locations = list(zip(LAT,LON)) # provide the latitudes and longitudes
    sensor_location_layer = gmaps.symbol_layer(locations, fill_color='red', stroke_color='red', scale=2)
    fobj.add_layer(sensor_location_layer)
    
    leuven_city_center_layer = gmaps.marker_layer(list(zip([50.879800], [4.700500])))
    fobj.add_layer(leuven_city_center_layer)
    
    return fobj
import gmaps
import gmaps.datasets
gmaps.configure(api_key="AI...")  # Your Google API key

locations = gmaps.datasets.load_dataset("taxi_rides")

fig = gmaps.figure()

# locations could be an array, a dataframe or just a Python iterable
fig.add_layer(gmaps.heatmap_layer(locations))

fig
Example #32
0
from sklearn.ensemble import IsolationForest

clf = IsolationForest(max_samples=100, random_state=rng)
clf.fit(df)
y = clf.predict(df)
print y


# ### Location based prices ###
# House prices don't only depend on the size of the house or amount of rooms, but are also really dependant on the location of said house. To get an idea how the position might impact my data I analyse the relationship between location and price in my dataset.

# In[ ]:

import gmaps
gmaps.configure(api_key="AIzaSyDPWAl8lcrK9q-tOkrl64sGkxDnbWz47Ko")

locations = df[["lat", "long"]]
prices = df["price"]

heatmap_layer = gmaps.heatmap_layer(locations, weights=prices)
heatmap_layer.max_intensity = 7200000
heatmap_layer.point_radius = 4

fig = gmaps.figure()
fig.add_layer(heatmap_layer)
fig


# This graph shows that there seems to be a real relationship between location and price. Especially in the center of Seattle the prices are much higher. There is also the town of Snoqualmie which is known for having a lot of highly educated inhabitants. That circumstance leads to the people of Snoqualmie having a substantially higher household income than the average. 
#