Пример #1
0
def mapview():
    mymap = Map(
        identifier="view-side",
        lat=37.4419,
        lng=-122.1419,
        markers=[(37.4419, -122.1419)]
    )
    sndmap = Map(
        identifier="sndmap",
        lat=37.4419,
        lng=-122.1419,
        markers={'http://maps.google.com/mapfiles/ms/icons/green-dot.png':[(37.4419, -122.1419)],
                 'http://maps.google.com/mapfiles/ms/icons/blue-dot.png':[(37.4300, -122.1400)]}
    )
    return render_template('example.html', mymap=mymap, sndmap=sndmap)
Пример #2
0
def buscar():
    termino = request.form['text']

    q = termino
    geocode = '36.2780990,-6.0862070,100km'

    twitter_api = ApiTwitter.oauth_login()
    tweets = twitter_api.search.tweets(q=q, geocode=geocode)
    ApiTwitter.save_json("Gtweets", tweets)

    #Recuperamos el fichero json para trabajar con los datos obtenidos de twitter
    datos = json.loads(open('Gtweets.json').read())
    lista = []
    for result in datos["statuses"]:
        if result["coordinates"]:
            xy = [
                result["coordinates"].values()[1][1],
                result["coordinates"].values()[1][0]
            ]
            lista.append(xy)
    mymap = Map(identifier="view-side",
                lat=36.2780990,
                lng=-6.0862070,
                markers=lista,
                style="height:700px; width:700px;margin:0;")
    return render_template('template.html', mymap=mymap)
def mapview():
    mymap = Map(identifier='view-side',
                lat=40.45,
                lng=3.75,
                markers=lista,
                style="height:600px;width:600px;margin:0",
                zoom=4)
    return render_template('template2.html', mymap=mymap)
Пример #4
0
def mapview():
    mymap = Map(identifier="view-side",
                lat=40.45,
                lng=-3,
                markers=sitioTweets,
                style="height:800px;width:800px;margin:0",
                zoom=6)
    return render_template('mapa.html', mymap=mymap)
Пример #5
0
def index():
    mymap = Map(
        identifier="view-side",
        lat=10.383734,
        lng=-61.244866,
        markers=[],
        zoom=10
    )
    return render_template('index.html', mymap=mymap, wf=1)
Пример #6
0
def mapview():
	mymap = Map(
		identifier="view-side",
		lat=36.516380894202264,
		lng=-6.282446299999947,
		markers=lista_coordenadas,
		style="height:800px;width:800px;margin:0;" 
	)
	return render_template('mapa.html', mymap=mymap)
Пример #7
0
def yelp(start):

    data = puppies(start)
    #print data

    lat, lng = get_coordinates(start)
    location = (lat, lng)

    names = data.keys()
    coordinates = []
    longitudes = []
    latitudes = []

    ratings = []
    parks = []

    for park in names:

        address = (data[park])[0]
        coordinate = address['coordinate']

        rating = (data[park])[1]
        if 'stars_5.png' in rating:
            rating = '5'
        elif 'stars_4_half.png':
            rating = '4.5'
        else:
            rating = rating
        ratings.append(rating)
        coordinates.append(coordinate)

    for coordinate in coordinates:
        latitude = coordinate['latitude']
        longitude = coordinate['longitude']
        parks.append((latitude, longitude))

    sndmap = Map(identifier="sndmap",
                 lat=lat,
                 lng=lng,
                 markers={
                     'http://maps.google.com/mapfiles/ms/icons/blue-dot.png':
                     location,
                     'http://maps.google.com/mapfiles/ms/icons/green-dot.png':
                     parks
                 })

    display_values = zip(names, ratings)
    print display_values

    return render_template('map_result.html',
                           location=location,
                           parks=parks,
                           names=names,
                           ratings=ratings,
                           display_values=display_values)
Пример #8
0
def create_map(style, markers, info_boxes, id):
    mymap = Map(
        identifier=id,
        lat=55.855478,
        lng=-4.2560766,
        style=style,
        zoom='10',
        maptype="TERRAIN",
        # Infobox is a list of a sequence of html tags. Example ["<img src='./static/a.jpg' height = 100 width = 100>", "<span><p>Text</p></span>"]
        # Just plain text does not display in infoboxes. It has to be put into a tag.
        infobox=info_boxes,
        # Markers is a list of tuples of coordinates. Example: {image:[(45.223, 92.114)]}
        markers=markers)
    return mymap
Пример #9
0
def cargarMapa(origen):
    lista = []
    for estado in origen["statuses"]:
        if estado["coordinates"] != None:
            coordenada = estado["coordinates"]
            lista.append(
                [coordenada.values()[1][1],
                 coordenada.values()[1][0]])
    mymap = Map(identifier="view-side",
                lat=40.3450396,
                lng=-3.6517684,
                zoom=5,
                markers=lista,
                style="height:800px;width:800px;margin:0;")
    return mymap
Пример #10
0
def profile():
    """ Profile of current user """
    from Dater.application.lang_values import default_label

    if current_user.coordinates:
        map_lat, map_lng = current_user.coordinates[
            0], current_user.coordinates[1]
        google_map = Map(identifier="view-side",
                         lat=map_lat,
                         lng=map_lng,
                         markers=[(map_lat, map_lng)])
    else:
        google_map = None

    return render_template('profile.html',
                           default_label=default_label,
                           google_map=google_map)
Пример #11
0
    def mapview():
        # creating a map in the view
        mymap = Map(
            identifier="view-side",
            lat=37.4419,
            lng=-122.1419,
            #markers=[(37.4419, -122.1419)]
            markers={
                'static/img/map-marker-green.png': [(37.4419, -122.1419)],
                'static/img/map-marker-red.png': [(37.4300, -122.1400)]
            })

        #{% for marker in markers %}
        #addMarker({{marker.lat}},{{marker.long}},'{{marker.name}}', '{{marker.url}}');
        #{% endfor %}

        return render_template('index.html', mymap=mymap)
Пример #12
0
def view_user(login_of_user):
    """ Profiles of other users """
    user = models.Users.objects.filter(login=login_of_user).first()
    if not user:
        abort(404)

    if user.coordinates:
        map_lat, map_lng = user.coordinates[0], user.coordinates[1]
        google_map = Map(identifier="view-side",
                         lat=map_lat,
                         lng=map_lng,
                         markers=[(map_lat, map_lng)])
    else:
        google_map = None

    return render_template('restricted-profile.html',
                           user=user,
                           google_map=google_map)
Пример #13
0
def mapview():
    termino = request.form['text']

    search_results = twitter_api.search.tweets(q=termino,
                                               geocode='40.45,-3.75,1000km')
    coordenadas = []
    for result in search_results["statuses"]:
        if result["geo"]:
            x = result["geo"]["coordinates"][0]
            y = result["geo"]["coordinates"][1]
            pair = [x, y]
            coordenadas.append(pair)

    mymap = Map(identifier="view-side",
                lat=40.45,
                lng=3.75,
                markers=coordenadas,
                style="height:600px;width:600px;margin:0",
                zoom=4)
    return render_template('mymap.html', mymap=mymap, busqueda=termino)
Пример #14
0
def show_map():
    db = get_db()
    cur = db.execute(
        'select cpu_ID, display_string, lat, lon, arbitraryText from records order by id desc'
    )
    records = cur.fetchall()

    # create list of markers from the lat/lng values for each records in the DB
    markerList = []
    for item in records:
        markerList.append((float(item[2]), float(item[3])))

    # create the map object
    mymap = Map(identifier="mymap",
                lat=-28,
                lng=135,
                zoom=4,
                markers=markerList,
                style="height:600px;width:800px;")

    return render_template('map_python.html', mymap=mymap)
Пример #15
0
def friends(tweetsamount):
    global usuarios

    listado = friendlist(oauth_login(),tweetsamount)
    l={}

    for e in listado:
        usuarios.add(e['usuario']['screen_name'])
        l.update({e['usuario']['profile_image_url']:[(e['longitud'],e['latitud'])]})

    mapa = Map(
        identifier="view-side",
        lat=40.3450396,
        lng=-3.6517684,
        zoom=6,
        markers=l,
        style="height:600px;width:800px;margin:0;"
    )

    guardarFichero()
    # Actualizamos valores de ThingSpeak
    streamFun()

    return render_template('mapa.html', mapa=mapa, tag="AMIGOS", listado=listado)
Пример #16
0
def mapview():
    mymap = Map(identifier="view-side",
                lat=37.4419,
                lng=-122.1419,
                markers=[(37.4419, -122.1419)])
    return render_template('example.html', mymap=mymap)