def testS2Rotate(self): mtv_a = s2.S2LatLng.FromDegrees(37.4402777, -121.9638888).ToPoint() mtv_b = s2.S2LatLng.FromDegrees(37.3613888, -121.9283333).ToPoint() angle = s2.S1Angle.Radians(0.039678) point = s2.Rotate(mtv_a, mtv_b, angle) self.assertEqual("37.439095,-121.967802", s2.S2LatLng(point).ToStringInDegrees())
def testGetIntersection(self): a = s2.S2LatLng.FromDegrees(-1, 0).ToPoint() b = s2.S2LatLng.FromDegrees(1, 0).ToPoint() c = s2.S2LatLng.FromDegrees(0, -1).ToPoint() d = s2.S2LatLng.FromDegrees(0, 1).ToPoint() # SWIG namespace flattening as above. intersection = s2.GetIntersection(a, b, c, d) self.assertEqual("0.000000,0.000000", s2.S2LatLng(intersection).ToStringInDegrees())
def center_coords(self): cellid = int(self.cellid, base=16) center_coords = s2.S2LatLng(s2.S2CellId(cellid).ToPoint()) return center_coords