コード例 #1
0
	def getFoodTrucksWithinRadius(cls, longitude, latitude, radius):

		#We get all food trucks
		allFoodTrucks = cls.getAllFoodTrucks()

		#We create a function that checks if the food truck is in the radius
		isInRadius = GeoTools.isInRadiusClosure(longitude, latitude, radius)

		#We want to filer only the food trucks within radius of long lat
		foodTrucks = filter(isInRadius, allFoodTrucks)
		
		return foodTrucks
コード例 #2
0
	def test_isInRadiusClosure_out_radius(self):
		#We define the isInRadius function
		longitude = -75.665030
		latitude = 45.434849
		radius = 0.5
		isInRadius = GeoTools.isInRadiusClosure(longitude, latitude, radius)

		#We pick a point about 1km away
		longitude = -75.659743
		latitude = 45.428984


		#We check if the point is in the radius
		result = isInRadius(PhysicalObject(longitude, latitude))
		self.assertEqual(False, result)