MCPcopy Create free account
hub / github.com/MacHu-GWU/uszipcode-project / dist_from

Method dist_from

uszipcode/model.py:144–152  ·  view source on GitHub ↗

Calculate the distance of the center of this zipcode from a coordinator. :param lat: latitude. :param lng: longitude. :param miles: if False, the value is in `kilometers`.

(self, lat, lng, miles=True)

Source from the content-addressed store, hash-verified

142 return hash(self.zipcode)
143
144 def dist_from(self, lat, lng, miles=True):
145 """
146 Calculate the distance of the center of this zipcode from a coordinator.
147
148 :param lat: latitude.
149 :param lng: longitude.
150 :param miles: if False, the value is in `kilometers`.
151 """
152 return great_circle((self.lat, self.lng), (lat, lng), miles=miles)
153
154 def to_json(self, include_null=True): # pragma: no cover
155 """

Callers 2

queryMethod · 0.80
test_by_coordinatesMethod · 0.80

Calls 1

great_circleFunction · 0.85

Tested by 1

test_by_coordinatesMethod · 0.64