Programming Assignment 2
Web Mashup: Display Best Restaurants on a Map

Due on Thursday February 23 before midnight

Description

The goal of this project is to create a web mashup that combines two web services: Google Maps and the Yelp API for Developers, using JavaScript and AJAX. After you center your Google Map to a geographical area and enter some terms, such as "Indian Restaurant", your application will find the best matches (eg, the best Indian restaurants) inside you map area, it will mark their location on the map, and will display some information about these restaurants on the web page.

This project must be done individually. No copying is permitted. Note: We will use a system for detecting software plagiarism, called Moss, which is an automatic system for determining the similarity of programs. That is, your program will be compared with the programs of the other students in class as well as with the programs submitted in previous years.

Note that, if you use a Search Engine to find similar programs on the web, we will find these programs too. So don't do it because you will get caught and you will get an F in the course (this is cheating). Don't look for code to use for your project on the web or from other students (current or past). Just do your project alone using the help given in this project description and from your instructor and GTA only. Finally, you should not post your code nor deploy your project on a public web site.

Platform

As in Project #1, you will develop this project on your PC/laptop using XAMPP and you will test it using using your Mozilla Firefox web browser. Download project2.zip and unzip it inside your web server document root directory. The project2 directory contains 4 files: OAuth.php, proxy.php, yelp.html, and yelp.js. The library OAuth.php is used for authentication and should not be changed. All the web service requests to yelp.com should go through the proxy.php. See the example in yelp.js. Your project is to edit yelp.html and yelp.js as described in the description of the web application.

Web Services used by the Web Mashup

For this project, you will use the

To use Google Maps, you need to create a Google Account (if you do not have one) and get an API key. To use the Yelp API v2, you need to register for an API key at the Yelp API page. You need to use the Yelp API v2. Do not use the Yelp API v3. After you register, you go to API v2 and then "Manage API access" and you click on "Generate new API v2.0 token/secret" from the Yelp API site. You cut-and-paste these 4 IDs in your proxy.php, and you test your setup on your web browser by using http://localhost/project2/yelp.html and by pushing the Find button. It will display the the top 5 Indian restaurants in Arlington in JSON format.

Project Description

You need to edit the HTML file yelp.html and the JavaScript file yelp.js. Your HTML web page must have 3 sections:

  1. a search text area to put search terms with a button "Find"
  2. a Google map of size 600*500 pixels, initially centered at (32.75, -97.13) with zoom level 16
  3. a text display area

When you write some search terms in the search text area, say "Indian buffet", it will find the 10 best restaurants in the map area that match the search terms. They may be less than 10 (including zero) sometimes. The map will display the location of these restaurants as map overlay markers with labels from 1 to 10. The text display area will display various information about these restaurants. It will be an ordered list from 1 to 10 that correspond to the best 10 matches. Each list item in the display area will include the following information about the restaurant: the image "image_url", the "name" as a clickable "url" to the Yelp page of this restaurant, the image "rating_img_url" (1-5 stars), and the "snippet_text". When you search for new terms, it will clear the display area and all the map overlay markers, and will create new ones based on the new search.

Note that everything should be done asynchronously and your web page should never be redrawn completely. You need only one XMLHttpRequest object for sending a request to Yelp, since Google Maps is already asynchronous. You should not use any JavaScript library, such as JQuery.

What to Submit

Use the form below to submit your project2.zip file. We do not accept email or hardcopy submissions. You may submit your files as many times as you like, but only the most recently submitted files will be retained and evaluated (newly submitted files replace the old files under the same file name). After you submit the files, please double-check that your submitted files are correct by clicking on the Status link.

Submit Project #2:

Last modified: 02/16/2017 by Leonidas Fegaras