def test_geo(self): gp1 = GeoCoordinates(self.valid_lat_lon_str) gp2 = GeoCoordinates(self.valid_lat_str, self.valid_lon_str) gp3 = GeoCoordinates(self.valid_lat_dec, self.valid_lon_dec) gp4 = GeoCoordinates(self.valid_lat_float, self.valid_lon_float) gp5 = GeoCoordinates([self.valid_lat_str, self.valid_lon_str]) gp6 = GeoCoordinates([self.valid_lat_dec, self.valid_lon_dec]) gp7 = GeoCoordinates([self.valid_lat_float, self.valid_lon_float]) gp8 = GeoCoordinates(self.valid_lat_neg, self.valid_lon_neg) gp8.latitude = self.valid_lat_str gp8.longitude = self.valid_lon_dec self.assertEqual(gp1.latitude, self.valid_lat_dec) self.assertEqual(gp1.longitude, self.valid_lon_dec) self.assertEqual(gp1, gp2) self.assertEqual(gp1, gp3) self.assertEqual(gp1, gp4) self.assertEqual(gp1, gp5) self.assertEqual(gp1, gp6) self.assertEqual(gp1, gp7) self.assertEqual(gp1, gp8) tgl = GeoLocation(Decimal('99999.9'), (Decimal('52.5'), Decimal('13.4'))) tgl2 = GeoLocation(Decimal('99999.9'), GeoCoordinates(Decimal('52.5'), Decimal('13.4'))) tgl3 = GeoLocation(Decimal('99998.9'), GeoCoordinates(Decimal('52.5'), Decimal('13.4'))) self.assertEqual(tgl.timestamp, Decimal('99999.9')) self.assertEqual(tgl.coordinates.latitude, Decimal('52.5')) self.assertEqual(tgl.coordinates.longitude, Decimal('13.4')) self.assertEqual(tgl, tgl2) self.assertNotEqual(tgl, tgl3) self.assertTrue(tgl > tgl3) s = GeoLocationSeries([tgl, tgl3]) joined_route = s.union( GeoLocationSeries([GeoLocation(100000.9, [23, 67]), ]) ) self.assertEqual("`m}mlw@_|l_I_expAA??A~u`sD_wcfI", str(joined_route))
def test_geo(self): gp1 = GeoCoordinates(self.valid_lat_lon_str) gp2 = GeoCoordinates(self.valid_lat_str, self.valid_lon_str) gp3 = GeoCoordinates(self.valid_lat_dec, self.valid_lon_dec) gp4 = GeoCoordinates(self.valid_lat_float, self.valid_lon_float) gp5 = GeoCoordinates([self.valid_lat_str, self.valid_lon_str]) gp6 = GeoCoordinates([self.valid_lat_dec, self.valid_lon_dec]) gp7 = GeoCoordinates([self.valid_lat_float, self.valid_lon_float]) gp8 = GeoCoordinates(self.valid_lat_neg, self.valid_lon_neg) gp8.latitude = self.valid_lat_str gp8.longitude = self.valid_lon_dec self.assertEqual(gp1.latitude, self.valid_lat_dec) self.assertEqual(gp1.longitude, self.valid_lon_dec) self.assertEqual(gp1, gp2) self.assertEqual(gp1, gp3) self.assertEqual(gp1, gp4) self.assertEqual(gp1, gp5) self.assertEqual(gp1, gp6) self.assertEqual(gp1, gp7) self.assertEqual(gp1, gp8) tgl = GeoLocation(Decimal('99999.9'), (Decimal('52.5'), Decimal('13.4'))) tgl2 = GeoLocation(Decimal('99999.9'), GeoCoordinates(Decimal('52.5'), Decimal('13.4'))) tgl3 = GeoLocation(Decimal('99998.9'), GeoCoordinates(Decimal('52.5'), Decimal('13.4'))) self.assertEqual(tgl.timestamp, Decimal('99999.9')) self.assertEqual(tgl.coordinates.latitude, Decimal('52.5')) self.assertEqual(tgl.coordinates.longitude, Decimal('13.4')) self.assertEqual(tgl, tgl2) self.assertNotEqual(tgl, tgl3) self.assertTrue(tgl > tgl3) s = GeoLocationSeries([tgl, tgl3]) joined_route = s.union( GeoLocationSeries([ GeoLocation(100000.9, [23, 67]), ])) self.assertEqual("`m}mlw@_|l_I_expAA??A~u`sD_wcfI", str(joined_route))
def get_full_route(self): result = GeoLocationSeries('') for route in self.defined_routes.all(): result = result.union(route.data) return result