Esempio n. 1
0
def makeMap(data):
    '''
    1. use Kmeans cluster lat and lon of each rsvp event
    2. plot them on a world map
    3. take a screenshot of the map and save
    '''
    geoplotlib.add_layer(KMeansLayer(data))
    geoplotlib.set_smoothing(True)
    geoplotlib.set_bbox(geoplotlib.utils.BoundingBox.WORLD)
    geoplotlib.savefig('clustermap')
    return None
Esempio n. 2
0
        k_means.fit(np.vstack([x, y]).T)
        labels = k_means.labels_

        self.cmap = create_set_cmap(set(labels), 'hsv')
        for l in set(labels):
            self.painter.set_color(self.cmap[l])
            self.painter.convexhull(x[labels == l], y[labels == l])
            self.painter.points(x[labels == l], y[labels == l], 2)

    def draw(self, proj, mouse_x, mouse_y, ui_manager):
        ui_manager.info(
            'Use left and right to increase/decrease the number of clusters. k = %d'
            % self.k)
        self.painter.batch_draw()

    def on_key_release(self, key, modifiers):
        if key == pyglet.window.key.LEFT:
            self.k = max(2, self.k - 1)
            return True
        elif key == pyglet.window.key.RIGHT:
            self.k = self.k + 1
            return True
        return False


data = geoplotlib.utils.read_csv('data/bus.csv')
geoplotlib.add_layer(KMeansLayer(data))
geoplotlib.set_smoothing(True)
geoplotlib.set_bbox(geoplotlib.utils.BoundingBox.DK)
geoplotlib.show()
Esempio n. 3
0
        while len(queue) > 0:
            qt = queue.pop()
            if qt.can_split(x, y):
                queue.extend(qt.split())
            else:
                done.append(qt)

        print((len(queue), len(done)))

        if self.cmap is not None:
            for qt in done:
                area = (qt.right - qt.left) * (qt.top - qt.bottom)
                self.painter.set_color(
                    self.cmap.to_color(1 + area, 1 + maxarea, 'log'))
                self.painter.rect(qt.left, qt.top, qt.right, qt.bottom)
        else:
            for qt in done:
                self.painter.linestrip([qt.left, qt.right, qt.right, qt.left],
                                       [qt.top, qt.top, qt.bottom, qt.bottom],
                                       closed=True)

    def draw(self, proj, mouse_x, mouse_y, ui_manager):
        self.painter.batch_draw()


data = geoplotlib.utils.read_csv('data/bus.csv')
geoplotlib.add_layer(QuadsLayer(data, cmap=None))
geoplotlib.set_smoothing(False)
geoplotlib.set_bbox(geoplotlib.utils.BoundingBox.DK)
geoplotlib.show()
Esempio n. 4
0
"""
Example of rendering shapefiles
"""
from geoplotlib.utils import BoundingBox
import geoplotlib


geoplotlib.shapefiles('data/dk_kommune/dk_kommune',
                  f_tooltip=lambda attr: attr['STEDNAVN'],
                  color=[0,0,255])

geoplotlib.set_smoothing(True)
geoplotlib.set_bbox(BoundingBox.DK)
geoplotlib.show()
Esempio n. 5
0
def draw_geo():
    data = geoplotlib.utils.read_csv('../data/des.csv')
    geoplotlib.add_layer(KMeansLayer(data))
    geoplotlib.set_smoothing(True)
    geoplotlib.show()
Esempio n. 6
0
        done = []
        while len(queue) > 0:
            qt = queue.pop()
            if qt.can_split(x, y):
                queue.extend(qt.split())
            else:
                done.append(qt)
        
        print len(queue), len(done)

        if self.cmap is not None:
            for qt in done:
                area = (qt.right - qt.left) * (qt.top - qt.bottom)
                self.painter.set_color(self.cmap.to_color(1 + area, 1 + maxarea, 'log'))
                self.painter.rect(qt.left, qt.top, qt.right, qt.bottom)
        else:
            for qt in done:
                self.painter.linestrip([qt.left, qt.right, qt.right, qt.left],
                                       [qt.top, qt.top, qt.bottom, qt.bottom], closed=True)
    
            
    def draw(self, proj, mouse_x, mouse_y, ui_manager):
        self.painter.batch_draw()
  

data = geoplotlib.utils.read_csv('data/bus.csv')
geoplotlib.add_layer(QuadsLayer(data, cmap=None))
geoplotlib.set_smoothing(False)
geoplotlib.set_bbox(geoplotlib.utils.BoundingBox.DK)
geoplotlib.show()