Exemplo n.º 1
0
    def getHeatmapOfMatches(self):
        #self.updateLocationDataFile()

        data = read_csv(self.location_data)
        print(data)

        geoplotlib.kde(data, bw=[5, 5])
        geoplotlib.show()
 def visualize_heatmap_for_data(self, df):
     """
     Normally visualize accidents distributions across borough
     :param df: Dataset
     :return: None
     """
     geo_data_for_plotting = {"lat": df["LATITUDE"], "lon": df["LONGITUDE"]}
     geoplotlib.kde(geo_data_for_plotting, 1)
     east = max(df["LONGITUDE"])
     west = min(df["LONGITUDE"])
     south = max(df["LATITUDE"])
     north = min(df["LATITUDE"])
     bbox = BoundingBox(north=north, west=west, south=south, east=east)
     geoplotlib.set_bbox(bbox)
     geoplotlib.tiles_provider('toner-lite')
     geoplotlib.show()
Exemplo n.º 3
0
def _draw_hot(day, hour, minute):
    """
    geoplotlib热力图
    :param day:
    :param hour, minute:
    :param tp:
    :return:
    """

    data = da.loc_state(day, hour, minute)

    bbox1 = BoundingBox(north=32, south=30.7, west=122.2, east=120.8)

    gp.set_bbox(bbox1)

    # gp.shapefiles('F:\\road_datas\\ShangHai\\boundary', shape_type='empty')
    gp.kde(data, bw=[0.5, 0.5], cmap='jet', scaling='wjk')
    gp.savefig('001')
    gp.show()
Exemplo n.º 4
0
def saveGeoData(dataFrame, feature, label, tag):
    plot_inc_d = {}
    for inc in dataFrame[feature].unique():
        accidents = dataFrame.loc[dataFrame[feature].isin([inc])]

        plot_inc = {}
        plot_inc = accidents[['LATITUDE', 'LONGITUDE']]
        plot_inc.columns = ['lat', 'lon']

        for col in plot_inc.columns:
            plot_inc_d[col] = plot_inc[col].tolist()

        # Plotting the data w. geoplotlib
        print label + ":", inc
        print "Samples:", len(accidents)
        gpl.kde(plot_inc_d, bw=1, cut_below=2e-4)
        gpl.set_bbox(
            BoundingBox(north=40.93, west=-73.85, south=40.53, east=-73.83))
        gpl.savefig('geo' + str(tag) + "_" + str(inc))
        plot_inc_d = {}
Exemplo n.º 5
0
    def drawmap(self):
        """
        Multiple examples of kernel density estimation visualization
        """
        data = self.get_dao_object()
        # geoplotlib.kde(data, bw=5, cut_below=1e-4)

        # lowering clip_above changes the max value in the color scale
        # geoplotlib.kde(data, bw=5, cut_below=1e-4, clip_above=.1)

        # different bandwidths
        geoplotlib.kde(data, bw=20, cmap=self.cmap, cut_below=1e-4)
        # geoplotlib.kde(data, bw=2, cmap='PuBuGn', cut_below=1e-4)

        # linear colorscale
        # geoplotlib.kde(data, bw=5, cmap='jet', cut_below=1e-4, scaling='lin')

        geoplotlib.set_bbox(BoundingBox.from_nominatim('CHINA'))

        geoplotlib.savefig(self.ouput_filename)
Exemplo n.º 6
0
import sys
import numpy
import geoplotlib
from geoplotlib.utils import read_csv, BoundingBox
from geoplotlib.colors import ColorMap

data = read_csv('data/out_FL.csv')
#TODO: apply filtering here rather than when making the csv
bb = BoundingBox.from_points(lons=data['lon'], lats=data['lat'])

#TODO: utilize layers
#mark the station locations
geoplotlib.dot(data, color=[0, 0, 0, 255])

#TODO: show based on zoom level
#geoplotlib.labels(data,'Station Name (LEA)', color=[150,150,190,255], font_size=9, anchor_x='center')

#geoplotlib.voronoi(data, cmap='Blues_r', max_area=8e3, alpha=200, f_tooltip=lambda d:d['Station Name (LEA)'] )

geoplotlib.kde(data, cmap='Blues_r', bw=10, cut_below=1e-4, scaling='lin')

#geoplotlib.delaunay(data,cmap='hot_r')

##post
geoplotlib.set_bbox(bb)
geoplotlib.set_smoothing(True)
geoplotlib.show()
Exemplo n.º 7
0
"""
Multiple examples of kernel density estimation visualization
"""
import geoplotlib
from geoplotlib.utils import read_csv, BoundingBox, DataAccessObject

data = read_csv('data/opencellid_dk.csv')

geoplotlib.kde(data, bw=[5, 5], cut_below=1e-6)

# lowering clip_above changes the max value in the color scale
#geoplotlib.kde(data, bw=[5,5], cut_below=1e-6, clip_above=1)

# different bandwidths
#geoplotlib.kde(data, bw=[20,20], cmap='coolwarm', cut_below=1e-6)
#geoplotlib.kde(data, bw=[2,2], cmap='coolwarm', cut_below=1e-6)

# linear colorscale
#geoplotlib.kde(data, bw=[5,5], cmap='jet', cut_below=1e-6, scaling='lin')

geoplotlib.set_bbox(BoundingBox.DK)
geoplotlib.show()
Exemplo n.º 8
0
#!/usr/bin/env python2
import geoplotlib
from geoplotlib.utils import read_csv, BoundingBox, DataAccessObject

data = read_csv('filtered_lonlat.csv')

# http://andreacuttone.com/geoplotlib/api.html#module-geoplotlib
geoplotlib.dot(data, color=[0,0,0], point_size=1.5)
geoplotlib.kde(data, bw=10, cmap='PuBuGn', cut_below=1e-4, clip_above=1e-2, alpha=180)
geoplotlib.graph(read_csv('group0.csvgraph.csv'), src_lat='flat', src_lon='flon',
        dest_lat='tlat', dest_lon='tlon', color=[0,0,0], linewidth=2)
geoplotlib.graph(read_csv('group1.csvgraph.csv'), src_lat='flat', src_lon='flon',
        dest_lat='tlat', dest_lon='tlon', color=[0,255,0], linewidth=2)
geoplotlib.graph(read_csv('group2.csvgraph.csv'), src_lat='flat', src_lon='flon',
        dest_lat='tlat', dest_lon='tlon', color=[128,0,128], linewidth=2)
geoplotlib.kde(read_csv('chokepoints.csv'), bw=10, cmap='hot',
        cut_below=1e-4, clip_above=1e-2, alpha=180)

bbox = BoundingBox(north=25.7188,west=-80.280,south=25.711,east=-80.280)
geoplotlib.set_bbox(bbox)
geoplotlib.set_window_size(1400, 1600)
#geoplotlib.set_window_size(700, 800)
geoplotlib.tiles_provider('toner')
geoplotlib.set_smoothing(True)
geoplotlib.savefig('output')
#geoplotlib.show()
Exemplo n.º 9
0
# https://www.researchgate.net/publication/305983877_Geoplotlib_a_Python_Toolbox_for_Visualizing_Geographical_Data
# git repo: https://github.com/andrea-cuttone/geoplotlib
# wiki: https://github.com/andrea-cuttone/geoplotlib/wiki/User-Guide#adding-interactivity-to-layers

import geoplotlib

#import os
#for filename in os.listdir():
#	print(filename)

print("trying to read plot.csv...")
thedata = geoplotlib.utils.read_csv('../data/ourplot.csv')
print("success")

# basic dot map
#geoplotlib.dot(thedata)

# heat map

geoplotlib.kde(thedata, bw=[5, 5])

# lowering clip_above changes the max value in the color scale
#geoplotlib.kde(thedata, bw=5, cut_below=1e-4, clip_above=.1)

# different bandwidths
#geoplotlib.kde(thedata, bw=20, cmap='PuBuGn', cut_below=1e-4)
#geoplotlib.kde(thedata, bw=2, cmap='PuBuGn', cut_below=1e-4)

print("showing map")
geoplotlib.show()
print("success")
Exemplo n.º 10
0
"""
Multiple examples of kernel density estimation visualization
"""
import geoplotlib
from geoplotlib.utils import read_csv, BoundingBox, DataAccessObject

data = read_csv('data/opencellid_dk.csv')

geoplotlib.kde(data, bw=5, cut_below=1e-4)

# lowering clip_above changes the max value in the color scale
#geoplotlib.kde(data, bw=5, cut_below=1e-4, clip_above=.1)

# different bandwidths
#geoplotlib.kde(data, bw=20, cmap='PuBuGn', cut_below=1e-4)
#geoplotlib.kde(data, bw=2, cmap='PuBuGn', cut_below=1e-4)

# linear colorscale
#geoplotlib.kde(data, bw=5, cmap='jet', cut_below=1e-4, scaling='lin')

geoplotlib.set_bbox(BoundingBox.KBH)
geoplotlib.show()
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import geoplotlib
from geoplotlib.utils import read_csv, BoundingBox
import sys

args = sys.argv
if len(args) != 2:
    sys.exit(f"usage: ./{args[0]} /path/to/.csv")

data = read_csv(args[1])
geoplotlib.kde(data, 5, cut_below=1e-4, show_colorbar=False)
geoplotlib.set_bbox(BoundingBox.USA)
geoplotlib.show()
Exemplo n.º 12
0
"""
Multiple examples of kernel density estimation visualization
"""
import geoplotlib
from geoplotlib.utils import read_csv, BoundingBox, DataAccessObject

data = read_csv('data/opencellid_dk.csv')

geoplotlib.kde(data, bw=[5,5], cut_below=1e-6)

# lowering clip_above changes the max value in the color scale
#geoplotlib.kde(data, bw=[5,5], cut_below=1e-6, clip_above=1)

# different bandwidths
#geoplotlib.kde(data, bw=[20,20], cmap='coolwarm', cut_below=1e-6)
#geoplotlib.kde(data, bw=[2,2], cmap='coolwarm', cut_below=1e-6)

# linear colorscale
#geoplotlib.kde(data, bw=[5,5], cmap='jet', cut_below=1e-6, scaling='lin')

geoplotlib.set_bbox(BoundingBox.DK)
geoplotlib.show()
Exemplo n.º 13
0
"""
Multiple examples of kernel density estimation visualization
"""
import geoplotlib
from geoplotlib.utils import read_csv, BoundingBox, DataAccessObject

data = read_csv('data/opencellid_dk.csv')

#geoplotlib.kde(data, bw=5, cut_below=1e-4)

# lowering clip_above changes the max value in the color scale
#geoplotlib.kde(data, bw=5, cut_below=1e-4, clip_above=.1)

# different bandwidths
geoplotlib.kde(data, bw=20, cmap='OrRd', cut_below=1e-4)
#geoplotlib.kde(data, bw=2, cmap='PuBuGn', cut_below=1e-4)

# linear colorscale
#geoplotlib.kde(data, bw=5, cmap='jet', cut_below=1e-4, scaling='lin')

geoplotlib.set_bbox(BoundingBox.from_nominatim('CHINA'))

geoplotlib.savefig('full.png')
geoplotlib.show()
Exemplo n.º 14
0
def show_geoplot(results, mbc):
	data=DataAccessObject.from_dataframe(results[["lat","lon"]])
	gpl.hist(data, colorscale='sqrt', binsize=4)
	gpl.kde(data, bw=5, cut_below=1e-3)
	gpl.set_bbox(BoundingBox(mbc[0],mbc[1],mbc[2],mbc[3]))
	gpl.show()