Programming Assignment 2
Web Mashup: Display House Prices on a Map

Due on Tuesday September 30 before midnight

Description

The goal of this project is to create a web mashup that combines two web services: Google Maps and the Zillow API, using JavaScript and AJAX. When you click on a house on the map, your application will display the postal address and the price of the house.

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. This program will find similarities even if you rename variables, move code, change code structure, etc.

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). Don't try to hire a freelancer to do the coding for you. Just do your project alone using the help given in this project description and from your instructor and GTA only.

Platform

As in Project #2, you will develop this project on the Omega web server and you will test the project on your PC/laptop using the Mozilla Firefox web browser. Login at omega.uta.edu using SSH and do the following:

cd public_html
wget http://lambda.uta.edu/cse5335/project2.tgz
tar xfz project2.tgz
cp project1/.htaccess project1/.htpasswd project2/
cd project2
The project2 directory contains 3 files: proxy.php, map.html, and map.js. As in project #1, you should not change proxy.php. All the web service requests to zillow.com should go through this proxy. See the example in map.js. Your project is to edit map.html and map.js as explained 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 Zillow API, you need to register and obtain a web service ID from Zillow Web Services ID (ZWSID). After you get the API key, you put it in map.js and you test your setup on your web browser by using the URL address:
http://omega.uta.edu/~xyz1234/project2/map.html
(use your username instead of xyz1234) and by typing the address of some existing house. It will display the estimated value of this house (empty if the address is invalid).

Project Description

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

  1. an input text area with two buttons: Find and Clear.
  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

Your program must insert a number of overlay markers on the Google map, where each marker pinned on a house must display the house's postal address and its Zestimate value (the house value) from zillow.com. The same information must be appended at the end of the text display area (third section). There are two ways to create a marker:

  1. When you provide a valid postal address, say "904 Austin St, Arlington, TX 76012", in the input text area and you push the Find button.
  2. When you click on a house on the map.
To implement the first way, you need to get the address from the input text area and send an asynchronous request to the Zillow API (GetSearchResults API) to retrieve the Zestimate (in $), which is the estimated home value of the house at that address. The address used by the GetSearchResults API must have two components: address and citystatezip. This means that you must use JavaScript code to break the address string from the input text area into these two strings. Then you insert a new overlay marker on the map at the latitude and longitude of this postal address, using Geocoding. To implement the second way, when you click on the map, your program must find the address of the point you clicked (using Reverse Geocoding) and must send an asynchronous request to the Zillow API (GetSearchResults API) to retrieve the Zestimate (in $), which is the estimated home value of the house at that address.

Note that the call to the GetSearchResults API must be done using Ajax: inside the callback function (the listener for the left click) of the map, you should create an Ajax request that calls the GetSearchResults API. When the result arrives (this is the callback of the Ajax request), you extract the Zestimate and you display a new overlay marker on the map at the point you clicked. The overlay marker must display the house postal address and its Zestimate. The same information must be appended at the end of the text display area (third section). Note also that the map may display multiple markers with Zestimates and the text display area may contain multiple addresses/zestimates. Basically, each time you enter a new postal address or when you click on the map, if there is a Zestimate, you add a new flag in the map and you append a new entry in the display area. If it is an invalid address or there is no Zestimate value, you don't put any marker and you don't append any entry in the display area. Finally, the Clear button clears all markers from the google map and clears the text display.

Hints:

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 Zillow, since Google Maps is already asynchronous.

What to Submit

Important: In the comment on top of your map.html file, put the URL address to run your web application, such as http://omega.uta.edu/~xyz1234/project2/map.html. Use the form below to submit your map.html and map.js files. 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: 09/13/14 by Leonidas Fegaras