示例#1
0
def Staticsitedatetime(df, info, val, m):
    """
    Generate style data for GeoJson time stamp in GenStaticTimemap 
    Takes in a df and location, get the wanted value
    Functional for static and GPS data
    
    Created:2019/05/31
    """
    features = []  #array to append Geojson features too

    #get locations from info
    loc = info["Location:"][0]
    sen = info["Sensors:"][0]
    #print(loc)
    if "GPS" not in loc:  #check if its static of GPS data
        Lat = info["Location:"][2]
        lon = info["Location:"][3]
        #print("siteinfo",Lat,lon)
        # PMstyle=pd.DataFrame()
    #features=[]

    for index, row in df.iterrows():
        #print(index,row[val])
        pm = row[val]  #get value
        row["color"] = genfill_color(pm, 100)  #generate color
        if "GPS" in loc:  #if walk data get lat and lon
            lon = row["lon"]
            Lat = row["lat"]
        #freate GeoJson feature
        feature = {
            'type': 'Feature',
            'geometry': {
                'type': 'Point',
                'coordinates': [lon, Lat]
            },
            'properties': {
                # 'popup':location+" - "+sen+"<br>"+val+":"+str(round(pm,2)),
                'time': str(index),
                'style': {
                    'color': row['color']
                },
                'icon': 'circle',
                'iconstyle': {
                    'fillColor': row['color'],
                    'fillOpacity': 0.8,
                    'stroke': 'true',
                    'radius': 7
                }
            },
        }
        #append feature

        features.append(feature)
        features.append(plugins.Terminator().to_json(str(index)))
    return features, df
示例#2
0
def test_terminator():
    m = folium.Map([45., 3.], zoom_start=1)
    t = plugins.Terminator()
    m.add_children(t)
    m._repr_html_()

    out = m._parent.render()

    # Verify that the script is okay.
    tmpl = Template('L.terminator().addTo({{this._parent.get_name()}});')
    assert ''.join(tmpl.render(this=t).split()) in ''.join(out.split())
def test_terminator():
    m = folium.Map([45., 3.], zoom_start=1)
    t = plugins.Terminator().add_to(m)

    out = normalize(m._parent.render())

    # Verify that the script is okay.
    tmpl = Template('L.terminator().addTo({{this._parent.get_name()}});')
    expected = normalize(tmpl.render(this=t))
    assert expected in out

    bounds = m.get_bounds()
    assert bounds == [[None, None], [None, None]], bounds
示例#4
0

if __name__ == "__main__":

    input_files = []
    for filename in args.filename:
        input_files.append(filename.name)

    parsedlocations, frequentLocation = parser(input_files, args.accuracy)

    if args.heatmap:
        map_osm = folium.Map(
            location=[frequentLocation[0], frequentLocation[1]])
        heatmap(parsedlocations)
        if args.night:
            map_osm.add_children(plugins.Terminator())
        map_osm.save('./heat_map.html')
        map_osm._repr_html_()

    if args.cluster:
        map_osm = folium.Map(
            location=[frequentLocation[0], frequentLocation[1]])
        cluster(parsedlocations)
        if args.night:
            map_osm.add_children(plugins.Terminator())
        map_osm.save('./cluster_map.html')
        map_osm._repr_html_()

    if args.stats:
        geolocator = Nominatim()
        location = geolocator.reverse(
示例#5
0
 def test_terminator(self):
     mapa = folium.Map([45., 3.], zoom_start=1)
     mapa.add_plugin(plugins.Terminator())
     mapa.add_plugin(plugins.ScrollZoomToggler())
     mapa._build_map()
示例#6
0
 def test_terminator(self):
     mapa = folium.Map([45., 3.], zoom_start=1)
     mapa.add_children(plugins.Terminator())
     mapa.add_children(plugins.ScrollZoomToggler())
     mapa._repr_html_()