|
1 | | -import math |
2 | 1 | class LookaroundPanorama: |
3 | | - def __init__(self, panoid, region_id, lat, lon, unknown10, unknown11): |
| 2 | + def __init__(self, panoid, region_id, lat, lon, unknown10, unknown11, heading): |
4 | 3 | self.panoid = panoid |
5 | 4 | self.region_id = region_id |
6 | 5 | self.lat = lat |
7 | 6 | self.lon = lon |
8 | 7 | self.unknown10 = unknown10 |
9 | 8 | self.unknown11 = unknown11 |
10 | 9 | self.date = None |
| 10 | + self.heading = heading |
11 | 11 |
|
12 | | - ''' |
13 | | - Approximate heading of the panorama, assuming the POV is facing |
14 | | - to the left of the Apple Car in cthe direction of driving. |
15 | | - ''' |
16 | | - def heading(self): |
17 | | - # Whatever is the logic behind this? |
18 | | - # Who at Apple thought of these values? |
19 | | - |
20 | | - # unknown10 |
21 | | - # These are the extreme values of unkown10 I have observed in a random selection of about 1000 tiles. |
22 | | - # The values are in two clusters. |
23 | | - # In the range [1,2159] you're looking more west than east. |
24 | | - # In the range [14318,16383] you're looking more east than west. |
25 | | - westmin = 1 |
26 | | - westmax = 2159 |
27 | | - eastmin = 16383 # looking (north/south) and very slightly east |
28 | | - eastmax = 14318 # looking slightly (north/south) directly east |
29 | | - |
30 | | - # unknown11 |
31 | | - # This is slightly more speculative |
32 | | - northmin = 8204 # this is likely lower |
33 | | - northmax = 6054 |
34 | | - southmin = 8204 # this is likely lower |
35 | | - southmax = 10173 |
36 | | - |
37 | | - |
38 | | - ew=0 |
39 | | - if self.unknown10 < westmax: |
40 | | - # Looking west |
41 | | - ew = -(float(self.unknown10 - westmin) / float(westmax - westmin)) |
42 | | - elif self.unknown10 > eastmax: |
43 | | - # Looking east |
44 | | - ew = (float(self.unknown10 - eastmin) / float(eastmax - eastmin)) |
45 | | - |
46 | | - ns=0 |
47 | | - if self.unknown11 <= northmin: |
48 | | - # Looking north |
49 | | - ns = (float(self.unknown11 - northmin) / float(northmax - northmin)) |
50 | | - else: |
51 | | - ns = -(float(self.unknown11 - southmin) / float(southmax - southmin)) |
52 | | - |
53 | | - |
54 | | - print(ns,ew) |
55 | | - r = math.degrees(math.atan2(ew,ns)) |
56 | | - if r < 0: |
57 | | - r += 360 |
58 | | - return r |
59 | 12 |
|
60 | 13 |
|
61 | 14 | def __repr__(self): |
62 | 15 | return str(self) |
63 | 16 |
|
64 | 17 | def __str__(self): |
65 | | - return f"{self.panoid}/{self.region_id} ({self.lat:.6}, {self.lon:.6}) " \ |
| 18 | + return f"{self.panoid}/{self.region_id} ({self.lat:.6}, {self.lon:.6}) {self.heading}" \ |
66 | 19 | f"[{self.date.strftime('%Y-%m-%d')}]" |
0 commit comments