In [9]:
from '../src' import emapy as epy
import sys;


  File "<ipython-input-9-a10ce637eb68>", line 1
    from '../src' import emapy as epy
                ^
SyntaxError: invalid syntax

In [ ]:
locationAreaBoundingBox = (41.3248770036,2.0520401001,41.4829908452,2.2813796997)

In [ ]:
zone = 31

In [ ]:
anio = 2015
csvFile = '../data/external/accidents/ACCIDENTS_GU_BCN_' + str(anio) + str('.csv')
data = epy.getDatabase("accidents", 
                "csv", 
                csvFile, 
                ";", 
                False, 
                -1, 
                -2, 
                '', 
                True, 
                True, 
                zone,
                True)
allData = data[1]
dataSize = len(data[1])

In [ ]:
allStreets = epy.getDatabaseFromOSM('streetsBarcelona', 'way', False, True,locationAreaBoundingBox, '')

In [ ]:
map = epy.mapCreation(41.388790,2.158990)

In [ ]:
cluster = epy.mapWithMarkerCluster(map, "Accidents Barcelona")

In [ ]:
porc = 0
porcSee = 0
clor = 'blue'

for x in range(dataSize):
    death = allData[x]['properties'][u'Número de morts']
    minor = allData[x]['properties'][u'Número de lesionats lleus']
    serious = allData[x]['properties'][u'Número de lesionats greus']

    day = allData[x]['properties'][u'Dia de mes']
    month = allData[x]['properties'][u'Mes de any']
    year = allData[x]['properties'][u'NK Any']

    streetName = allData[x]['properties'][u'Nom carrer']

    description = allData[x]['properties'][u'Descripció causa vianant']
    lon = allData[x]['geometry'][0]
    lat = allData[x]['geometry'][1]
    
    greatLoc = epy.fromAllStreetsGetWithStreetNameTheLocationMostNear(allStreets, streetName, lon, lat)
    
    if int(death) > 0:
        clor = 'black'
    elif int(serious) > 0:
        clor = 'red'
    elif int(minor) > 0:
        clor = 'green'
    else:
        clor = 'blue'

    text = "Dia: "+ str(day) + '/' + str(month) + '/' + str(year) + '</br>' + 'Descripción: ' + description
    
    epy.mapAddMarkerToCluster(cluster, greatLoc[0], greatLoc[1], 'glyphicon-plus', clor, text)
    l = ( porc * 1.0 / dataSize * 1.0) * 100
    if l > porcSee:
        print l
        porcSee += 10
    porc += 1

In [ ]:
epy.mapSave(map, '../reports/maps/Accidents_correction.html')

In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]: