The code we are writing will be more interesting to use if we have a lot of data to work with. Companies like Google have invested significant resources in identifying places of interest and recording their names, addresses, and locations along with some tags that are relevant for searching. We don’t have the resources of a company like Google, but we have a lot of students. So we will use a crowdsourcing approach by having each student provide information for at least 10 places of interest in the general Tucson area. You can include any place that you think a U of A student would be likely to go including, for example, restaurants near the airport.
For each location, we want the following information:
Name of the place of interest
Street address (or similar description) for the place (not a complete address, just enough information to find it if you were near that location)
One or more search tags for this place
The latitude of this place
The longitude of this place
In this part of the assignment you will write client code to manipulate some GeoLocation objects. The GeoLocation class is being provided to you, so you don’t have to write it. You will instead be writing code that constructs and manipulates three GeoLocation objects.
2 of 2
The popular TV series Breaking Bad made use of geographic location information. The Walter White character buried millions of dollars at a particular location in the desert outside of Albuquerque, New Mexico. He then bought a lottery ticket to help him remember that his stash was buried at a latitude of 34 degrees, 59 minutes, 20 seconds and a longitude of -106 degrees, 36 minutes, 52 seconds. Your client program will compute the distance between Walter’s stash and the local FBI building and a local studio known as ABQ Studios (where Breaking Bad was filmed). Walter’s stash was supposedly buried in the desert, but from this client program, you’ll see that the coordinates they gave on the TV show are really the coordinates of the studio.
For this part of the assignment, you will write a class called PlaceInformation that stores information about a place of interest. It should have the following public methods:
__init__(name, address, tag, latitude, longitude)
distance_from(spot) # spot is a GeoLocation object
The first three “get” methods simply return the values that were provided when the object was constructed. The __str__ method should return the name followed by the location details inside parentheses (location details should formatted the same as in the __str__ method for GeoLocation). Although the constructor takes a latitude and longitude, you should store this information inside the PlaceInformation object using a GeoLocation object. The get_location method should return a reference to this GeoLocation object. Remember that in writing your class, you don’t want to include code that appears elsewhere. For example, your GeoLocation object knows how to compute a distance, so you should not be repeating the code for computing distances in your PlaceInformation class. You should instead be asking the GeoLocation object to perform the computation. Be sure to properly encapsulate your object with private fields.
We are providing a client program called place_information_client.py that can be used to test your class.