Question: (Please use the structure given. The d formula above is the great circle equation from a previous assignment that is required) Problem 1. (Geo Location)
(Please use the structure given. The d formula above is the great circle equation from a previous assignment that is required)
Problem 1. (Geo Location) Define a data type Location in location. py that represents a location on Earth using its latitude and longitude. The data type must support t e following API method description Location (lat, lon) a new location l from the given latitude and longitude values the great-circle distance between l and m 1.distanceTo (m) the string representation of l as (lat, lon) str (1) See Problem 7 from Project 2 for the great-circle distance formula. python location py 48.87 -2.33 37.8 122.4 (48.87 2.33) loci (37.8 122.4) lo c2 d (locl, loc2) 8701.38954324 d 111 arccos (sin(a1) sin (z2) cos(z1)cos (a2) cos(yi y2)) Great-Circle Distance Formula import math stdio import import sys class Location Represents a location on Earth def init (self, lat, lon Constructs a new location given its latitude and longitude values self lat self lon def distanceTo (self, other Returns the great-circle distance between self and other def str self Returns a string representation of self Test client DO NOT EDIT Reads floats latl, lonl, lat2, lon2 from command representing two locations on Earth constructs two Location objects from them, and writes them along with the great-circle distance between the two def main lat1, lonl lat2, lon2 map (float sys.argv locl Location (latl, lonl loc2 Location (lat2, lon2 stdio. writeln locl str OC1 stdio writeln loc2 str loc2 str distanceTo(loc2)) stdio writeln d loci, loc2 if name main main
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
