def getvehicle(): vehicle_map = init_vehicle_map if request.method == 'POST': if request.form['vehicle_id']: vehicle_id = request.form['vehicle_id'] day = request.form['day'] if day == "": now = datetime.datetime.now() day = now.strftime("%d/%m/%Y") apiday = now.strftime("%Y%m%d") else: apiday = day[6:10] + day[3:5] + day[0:2] #apiday="20160127" app.logger.debug('Debugging KILLRTAXI : %s', apiday) markers_map = getdata.getvehicles_forone(vehicle_id, apiday) if not isinstance(markers_map, list): app.logger.debug('Connection error : %s', markers_map) return render_template('getvehicle.html', vehicle_map=vehicle_map, error=ErrorMessage) nbmvts = len(markers_map) app.logger.debug('Debugging KILLRTAXI : %s', nbmvts) if nbmvts > 0: latmap = str(markers_map[0][0]) lngmap = str(markers_map[0][1]) zoom = 11 else: latmap = initlat lngmap = -initlng zoom = 5 vehicle_map = Map( identifier="view-side", lat=latmap, lng=lngmap, style="height:700px;width:700px;margin:10;", zoom=zoom, markers=markers_map #markers=[(54.96848201388808, 0.39963558097359564),(54.968382013888075, -0.39953558097359565)] ) return render_template('getvehicle.html', nbmvts=nbmvts, vehicle_id=vehicle_id, vehicle_map=vehicle_map, day=day) return render_template('getvehicle.html', vehicle_map=vehicle_map)
def hello(): mymap = Map( identifier="plinemap", style = "height:90%;width:100%;", lat=37.871853, lng=-122.258423, ) return render_template("index.html", plinemap=mymap)
def navigation(): mymap = Map(identifier="view_side", lat=34.749064, lng=127.655273, zoom=15, style="height:300px;width:device-width;margin:0;", markers=[(34.749063, 127.655273)]) return render_template('navigation.html', mymap=mymap)
def googlemaps(): mymap = Map(identifier="view-side", lat=37.4419, lng=-122.1419, markers=[(37.4419, -122.1419)]) return render_template('destino/choice.html', title='Google Maps', mymap=mymap)
def simple_view_one(): mymap = Map( identifier="view-side", # for DOM element varname="mymap", # for JS object name lat=37.4419, lng=-122.1419, markers=[(37.4419, -122.1419)]) return jsonify(mymap.as_json())
def update_location(self, lat, lon, dt=None): self.latitude = lat self.longitude = lon self.map = Map(identifier=self.map_id, lat=self.latitude, lng=self.longitude, markers=[(self.latitude, self.longitude)]) self.last_update = dt
def contacts(): # задаємо координати для карти mymap = Map(identifier="iService", lat=49.4090433, lng=27.0124982, markers=[(49.4090433, 27.0124982)]) return render_template('contacts.html', mymap=mymap)
def hometest(): list1 = [(37.4429, -122.1499), (37.4619, -122.3419), (37.4489, -122.1409)] mymap = Map(identifier="view-side", lat=37.4419, lng=-122.1419, markers=list1) sndmap = Map( identifier="sndmap", style="height:500px;width:100%;margin:0;;", lat=33.9676741, lng=-117.3323022, markers=[ { # 'icon': 'http://maps.google.com/mapfiles/ms/icons/green-dot.png', 'lat': 33.9676741, 'lng': -117.3323022, 'infobox': "<b>CS 172 Project HQ</b>", }, ]) results = [] if request.method == 'POST': print("Came Here!") tag = request.form['query'] results = searchIndex(tag) print(str(tag)) print(results) sndmap = Map(identifier="sndmap", style="height:500px;width:100%;margin:0;;", lat=37.4419, lng=-122.1419, markers=results, fit_markers_to_bounds=True) # print("in mapview function") return render_template('hometest.html', results=results) else: # creating a map in the view # return render_template('home_test.html', mymap=mymap, sndmap=sndmap) return render_template("hometest.html", results=results)
def get_map(loc): mymap = Map(identifier="view-side", lat=loc[0], lng=loc[1], markers=[{ 'icon': 'http://maps.google.com/mapfiles/ms/icons/blue-dot.png','zoom': 16, 'lat': loc[0], 'lng': loc[1], 'infobox': "<b>Your current location</b>", 'style':'width:500px'}]) return mymap
def search_store(): ''' Search for local stores ''' # initializes an empty list that will store a list of dictionaries that contain the coordinates for the # markers parameter of business_map coordinates_list = [] if request.method == 'POST': location = '' # obtains the user's current ip address if request.environ.get('HTTP_X_FORWARDED_FOR') is None: response = requests.get("http://ip-api.com/json") js = response.json() city = js['city'] lat = js['lat'] lng = js['lon'] else: ip = request.environ['HTTP_X_FORWARDED_FOR'] response = requests.get(f"http://ip-api.com/json/{ip}") js = response.json() city = js['city'] lat = js['lat'] lng = js['lon'] store_name = request.form.get('store_name') # yelp api that provides a list of stores with the category vegan near the user's current latitude/longitude search_results = yelp_api.search_query(term=store_name, latitude=lat, longitude=lng, categories="vegan") business_info = search_results['businesses'] # stores pin image and all lat/lng of queried stores into a dictionary to be passed into the map and displayed on the page for coordinate in business_info: coordinates_dict = {} coordinates_dict['icon'] = "/static/img/leaf_pin.png" coordinates_dict['lat'] = coordinate['coordinates']['latitude'] coordinates_dict['lng'] = coordinate['coordinates']['longitude'] # appends dictionary entry into the list coordinates_list.append(coordinates_dict) # defines the parameters of the map that will be displayed on the web page business_map = Map(identifier="test-map", style="height:700px;width:700px;margin:0;", lat=lat, lng=lng, markers=coordinates_list) return render_template('display_store.html', business_info=business_info, business_map=business_map) else: return render_template('search_store.html')
def result(): if request.method == 'POST': geocode_result = gmaps.geocode(request.form['LocationCity']) geo = geocode_result[0] geometry = geo['geometry'] location = geometry['location'] latitude = location['lat'] longitude = location['lng'] print "Lat: ", latitude, "\tLng: ", longitude north = latitude + 0.5 south = latitude - 0.5 west = longitude - 0.5 east = longitude + 0.5 print "North: ", north, "\tSouth: ", south, "\tEast: ", east, "\tWest: ", west earthquakes = requests.get( "http://api.geonames.org/earthquakesJSON?north=" + str(north) + "&south=" + str(south) + "&east=" + str(east) + "&west=" + str(west) + "&username=davethefinder") earthquakesJSON = earthquakes.json() markersData = earthquakesJSON['earthquakes'] marks = [] for x in markersData: mark = { 'icon': '//maps.google.com/mapfiles/ms/icons/red-dot.png', 'lat': x['lat'], 'lng': x['lng'], 'infobox': ("Datetime: %s" % x['datetime'] + "" "<br>Latitude: " + str(x['lat']) + "" "<br>Longitude: " + str(x['lng']) + "" "<br>Depth: " + str(x['depth']) + "" "<br>EQID: %s" % x['eqid'] + "" "<br>Magnitude: " + str(x['magnitude']) + "" "<br>Source: %s" % x['src'] + "") } marks.append(mark) eqmap = Map(identifier="eqmap", varname="eqmap", style=("height:75%;" "width:75%;" "top:1;" "left:1;" "right:1;" "position:absolute;"), lat=latitude, lng=longitude, markers=marks, zoom=9) return render_template('result.html', eqmap=eqmap)
def booking(): valid = True if request.method == 'POST': car_id = request.form['car'] start_date = request.form['sdate'] start_time = request.form['stime'] end_date = request.form['edate'] end_time = request.form['etime'] if mainEngine.validateBookingTime(start_date, start_time, end_date, end_time): time = mainEngine.getTotalBookingTime(start_date, start_time, end_date, end_time) cust = mainEngine.getCustomer(session['email']) plan = cust[7] cars = mainEngine.getCar(car_id) cost = 0 if plan == 0: cost = mainEngine.getTotalBookingCost(start_date, start_time, end_date, end_time, cars[0][10]) else: cost = mainEngine.getTotalBookingCost(start_date, start_time, end_date, end_time, 15) return render_template("customer/bookingPayment2.html", cars=cars, start_date=start_date, start_time=start_time, end_date=end_date, end_time=end_time, time=time, cost=cost, success=True) else: valid = False cars = mainEngine.getAvalaibleCars() mark = [] if cars: for car in cars: mark.append((float(car[12]), float(car[11]), car[1])) gmap = Map( identifier="gmap", varname="gmap", #MELBOURNE COORDINATE lat=-37.8136, lng=144.9631, markers={ icons.dots.blue: mark, }, style= "height:max-500px;max-width:1000px;margin:0;margin-left:auto;margin-right:auto;", ) return render_template("customer/booking2.html", cars=cars, gmap=gmap, valid=valid)
def movingmap(): mymap = Map(identifier="movingmap_markers", lat=37.4419, lng=-122.1419, markers=[{ 'lat': 37.4419, 'lng': -122.1419 }]) return render_template('movingmap.html')
def fn(): global MasterMap MasterMap = Map(identifier="view-side", lat=latCenter, lng=longCenter, markers=cluster(df), style="height:480px;width:850px;margin:0;", fit_markers_to_bounds=True) return MasterMap
def contact(): map = Map(identifier='mapa_wne', lat=52.247186, lng=21.003806, markers=[(52.247186, 21.003806)], fit_markers_to_bounds=False, style="height: 400px; width: 90%; margin-left: 5%;") return render_template('contact.html', page_title="Contact", mapa_wne=map)
def person(): polyline = { 'stroke_color': '#0AB0DE', 'stroke_opacity': 1.0, 'stroke_weight': 3, 'path': [{ 'lat': -8.831329, 'lng': 116.514596 }, { 'lat': -8.824975, 'lng': 116.514190 }, { 'lat': -8.819457, 'lng': 116.515542 }, { 'lat': -8.815350, 'lng': 116.510754 }, { 'lat': -8.819703, 'lng': 116.502612 }, { 'lat': -8.827473, 'lng': 116.511321 }, { 'lat': -8.831329, 'lng': 116.514596 }] } path1 = [(33.665, -116.235), (33.666, -116.256), (33.667, -116.250), (33.668, -116.229)] plinemap = Map( identifier="plinemap", varname="plinemap", lat=-8.831329, lng=116.514596, style=("height:80%;" "width:50%;" "top:100;" "left:10;" "position:absolute;" "z-index:200;"), markers=[{ 'icon': 'https://files.slack.com/files-pri/T02MNHHJA-F971R9ZFD/ship.png', 'lat': -8.831329, 'lng': 116.514596, 'infobox': "<b>Budi julaeha<br/>pangandaran</b>" }], polylines=[polyline, path1]) return render_template('fish.html', plinemap=plinemap)
def admin_dashboard(): ip_markers = [] # get all request ip requests = Request.query.all() if requests is not None: for req in requests: location = get_loc_by_ip(req.ip_address) if location is not None: ip_markers.append(location) map = Map("admin-google-map", lat=17.685895, lng=77.158687, zoom=3, markers=ip_markers) else: map = Map("admin-google-map", lat=17.685895, lng=77.158687, zoom=3) return render_template('admin/dashboard.html', map=map)
def page_not_found(e): error = 'The server is currently encountering some issues. Please try again later. 504 Response' mymap = Map( identifier="view-side", # set of lat and long centers to the new global variables lat=latitude, lng=longitude, style="height: 100%; width: 100%") return render_template('application.html', mymap=mymap, error=error)
def list_get(): global marks SQL = 'SELECT * FROM object' area = request.form.get('check_area') floor = request.form.get('check_floor') price = request.form.get('check_price') size = request.form.get('check_size') if area == None and floor == None and price == None and size == None: pass else: check = 0 SQL += " WHERE " if size != None: size_low = request.form.get('size_low') SQL += "size >= " + size_low size_high = request.form.get('size_high') SQL += " and size <= " + size_high check = 1 if price != None: if check == 1: SQL += " and " price_low = request.form.get('price_low') SQL += "price >= " + price_low price_high = request.form.get('price_high') SQL += " and price <= " + price_high check = 1 if area != None: if check == 1: SQL += " and " text_area = request.form.get('text_area') SQL += "area = " + '"' + text_area + '"' check = 1 if floor != None: if check == 1: SQL += " and " text_floor = request.form.get('text_floor') SQL += "floor = " + text_floor print SQL data = dbRead(SQL) marks = [] for cnt in range(len(data)): marks.append((data[cnt][7], data[cnt][8])) mark = tuple(marks) try: lat = marks[0][0] lng = marks[0][1] except: lat = 25.056075 lng = 121.580203 sndmap = Map(style="height:700px;width:700px;margin:0;", zoom=13, identifier="sndmap", lat=lat, lng=lng, markers={icons.dots.green: mark}) #return render_template('app.html', sndmap=sndmap) return render_template('list.html', marks=data, sndmap=sndmap)
def search_results(search): q = search.data["search"] index = search.data["select"] markers = [] print("[+] Querying Searcher..") try: cmd = ["java", "Searcher", "-q", q, "-f", index] p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() res = json.loads(out) except: res={'results':[]} print("[!] NO Results: ", res) print("[+] Done Querying Searcher") if len(res['results']) != 0: # TODO: Move time parsing to backend Searcher class print("[+] Parsing Time: ") for i, t in enumerate(res['results']): tstamp = t["timestamp"].split(" ") dow = tstamp[0] month = tstamp[1] day = tstamp[2] time = tstamp[3] year = tstamp[5] d = datetime.strptime(time, "%H:%M:%S") res['results'][i]["formatedtime"] = month +" "+ day+ " "+ year + " at: "+ d.strftime("%I:%M %p") print("[+] Done Parsing Time") print("[+] Creating Locations...") # partitionList into n parts to thread getlocation n times splitres =partitionList(res['results'], 8) threadList = [] marks = [] for result in splitres: t1 = threading.Thread(target=getLocations, args=(result,marks)) t1.start() threadList.append(t1) for thread in threadList: thread.join() markers += marks if len(markers) == 0: info = {} info['icon'] = 'http://maps.google.com/mapfiles/ms/icons/green-dot.png' info['lng'] = -117.3755 info['lat'] = 33.9806 info['infobox'] = "Testing" markers.append(info) cur_location = geocoder.ip('me').latlng tweetmap = Map(identifier="tweetmap", zoom=9, fit_markers_to_bounds=True, lat=cur_location[0], lng=cur_location[1], markers=markers) print("[+] Done Creating Locations") print("[+] Done processing Results... Rendering 'results.html'") return render_template( 'results.html', ranked_data=res["results"], tweetmap=tweetmap)
def mapview(): sndmap = Map(identifier="sndmap", lat=36.7783, lng=119.4179, markers={ 'http://maps.google.com/mapfiles/ms/icons/green-dot.png': [(36.7783, 119.4179)] }) return render_template('example.html', sndmap=sndmap)
def userHome(): if session.get('user'): mymap = Map(identifier="view-side", lat=37.4419, lng=-122.1419, markers=[(37.4419, -122.1419)]) return render_template('demo.html', mymap=mymap) else: return render_template('error.html', error='Unauthorized Access')
def map(): geolocator = Nominatim() location = geolocator.geocode("175 5th Avenue NYC") # creating a map in the view mymap = Map(identifier="view-side", lat=location.latitude, lng=-location.longitude, 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('map.html', mymap=mymap, sndmap=sndmap)
def get_map(): fullmap = Map( identifier="fullmap2", style='height:100%;width:100%;top:0;left:0;position:absolute;z-index:200;', lat=origin_lat, lng=origin_lon, markers=get_pokemarkers(), zoom='15', ) return fullmap
def mapview(): # creating a map in the view sndmap = Map(identifier="sndmap", lat=float(lat), lng=float(lng), markers=gpsList, zoom=16, style="height:1200px;width:850px;margin:0;") return render_template('map01.html', sndmap=sndmap)
def explore(): page = request.args.get('page', 1, type=int) posts = Post.query.order_by(Post.timestamp.desc()).paginate( page, my_app.config['POSTS_PER_PAGE'], False) next_url = url_for('explore', page=posts.next_num) \ if posts.has_next else None prev_url = url_for('explore', page=posts.prev_num) \ if posts.has_prev else None markers = list() users = User.query.filter(User.id == Post.user_id and Post.body in posts.items) for user_ in users: if user_.location_longitude and user_.location_latitude: marker = { 'icon': 'http://maps.google.com/mapfiles/ms/icons/green-dot.png', 'lat': float(user_.location_latitude), 'lng': float(user_.location_longitude), 'infobox': Post.query.filter(Post.user_id == user_.id and Post.body in posts.items) } markers.append(marker) if current_user.location_latitude and current_user.location_longitude: mymap = Map(identifier="view-side", lat=float(current_user.location_latitude), lng=float(current_user.location_longitude), markers=markers) else: mymap = Map(identifier="view-side", lat=37.4419, lng=-122.1419, markers=markers, center_on_user_location=True) return render_template('index.html', title='Запросы', posts=posts.items, next_url=next_url, prev_url=prev_url, mymap=mymap)
def mapview(): # creating a map in the view fn = "Divvy_Trips_2017_Q3Q4/Divvy_Stations_2017_Q3Q4.csv" otherfn = "Divvy_Trips_2017_Q3Q4/Divvy_Trips_2017_Q3.csv" data = readdict(fn) # other_data = readdict(otherfn) # other_data = data_cleanup_missing(other_data) # frequency_dictionary, most_common = get_frequency_dictionaries(other_data, other_data[0].keys()) # print(frequency_dictionary['gender']) frequency_dictionary = load_obj('frequency_dictionary') # frequency_dictionary, most_common = standard_procedures(otherfn) lat = get_attribute(data, "latitude", float) lon = get_attribute(data, "longitude", float) names = get_attribute(data, "name") stations = [] stations2 = [] for idx, l in enumerate(lat): stations.append(( lat[idx], lon[idx], names[idx], "https://maps.gstatic.com/intl/en_us/mapfiles/markers2/measle_blue.png" )) stations2.append({ "lat": lat[idx], "lng": lon[idx], "name": names[idx], "img": "https://maps.gstatic.com/intl/en_us/mapfiles/markers2/measle_blue.png" }) mymap = Map(scale=2, identifier="view-side", lat=41.8781, lng=-87.6298, markers=stations, fit_markers_to_bounds=True, style="height:500px;width:100%;") # bikeLayer = GoogleMaps.BicyclingLayer # BicyclingLayer.setMap(mymap) stations2 = json.dumps(stations2) # stations2 = stations2.replace("\"","") # print(stations2) # stations2 = json.loads(stations2) # print(stations2) # print(stations) return render_template('example.html', mymap=mymap, json_stations=stations2, frequencies=json.dumps(frequency_dictionary))
def mapview(): # Load pokestop locations try: csv_file = csv.reader(open("pokestops.csv", "rb")) except: csv_file = csv.reader(open("data.csv", "rb")) for row in csv_file: pokestopid = int(row[0]) marker_lat = row[1] marker_lon = row[2] try: quest = row[3] except: quest = 0 html_form = "<form action=\"submitdata\">Select quest<br><input type=\"hidden\" name=\"pokestopid\" value=" + str( pokestopid) + ">" + str( quest_text ) + "<br><input type=\"submit\" value=\"Submit\"></form>" pokestopcache[pokestopid] = {} if str(quest) == '0': pokestopcache[pokestopid][ 'icon'] = 'http://maps.google.com/mapfiles/ms/icons/green-dot.png' pokestopcache[pokestopid]['infobox'] = html_form else: print pokestopid pokestopcache[pokestopid][ 'icon'] = 'http://maps.google.com/mapfiles/ms/icons/red-dot.png' pokestopcache[pokestopid]['infobox'] = 'Quest entered:<br>' + str( quest_list[int(quest)]) pokestopcache[pokestopid]['lat'] = marker_lat pokestopcache[pokestopid]['lng'] = marker_lon marker_temp.append(pokestopcache[pokestopid]) # creating a map in the view pokestopmap = Map( identifier="pokestopmap", lat=37.968193, lng=-122.528441, markers=marker_temp, style="width:800px;height:600px;" # markers=[ # { # 'icon': 'http://maps.google.com/mapfiles/ms/icons/green-dot.png', # 'lat': 37.4419, # 'lng': -122.1419, # 'infobox': "<b>Hello World</b>" # }, # { # 'icon': 'http://maps.google.com/mapfiles/ms/icons/blue-dot.png', # 'lat': 37.4300, # 'lng': -122.1400, # 'infobox': "<b>Hello World from other place</b>" # } # ] ) return render_template('example.html', pokestopmap=pokestopmap)
def __init__(self, name): self.name = name self.latitude = 42.4343779 self.longitude = -83.9891627 self.map_id = name + '_map' self.map = Map(identifier=self.map_id, lat=self.latitude, lng=self.longitude, markers=[(self.latitude, self.longitude)]) self.last_update = None
def main(): mymap=Map( identifier="mymap", lat=netData[6][0], lng=netData[7][0], markers=netMapInfo, style="height:700px;width:700px;margin:0;" ) return( render_template("map.html", mymap=mymap) )