| Conditions | 4 |
| Total Lines | 36 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 19 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | """Makes geo chart with plots of GPS data/""" |
||
| 10 | 1 | def gps_check(photos: list) -> px.scatter_mapbox: |
|
| 11 | """GPS_Check. |
||
| 12 | |||
| 13 | Takes a list of photos and creates a geo plot of them |
||
| 14 | |||
| 15 | Arguments: |
||
| 16 | photos {list} -- A list of dictionaries with phot information. |
||
| 17 | |||
| 18 | Returns |
||
| 19 | px.scatter_mapbox -- Map plot with photos plotted. |
||
| 20 | """ |
||
| 21 | 1 | log.info("Starting GPS Chart") |
|
| 22 | 1 | lats = [] |
|
| 23 | 1 | longs = [] |
|
| 24 | 1 | gps_photos = [] |
|
| 25 | |||
| 26 | 1 | for each in photos: |
|
| 27 | 1 | if "GPS GPSLatitudeRef" in each.keys(): |
|
| 28 | 1 | gps_photos.append(each["item"]) |
|
| 29 | 1 | gps_data = utils.gps_parse(each) |
|
| 30 | 1 | lats.append(gps_data["latitude"]) |
|
| 31 | 1 | longs.append(gps_data["longitude"]) |
|
| 32 | 1 | log.debug("%s has GPS data", each["item"]) |
|
| 33 | else: |
||
| 34 | 1 | log.info("%s has no GPS data", each["item"]) |
|
| 35 | |||
| 36 | 1 | points = [] |
|
| 37 | 1 | for x, _ in enumerate(gps_photos): |
|
| 38 | 1 | points.append((lats[x], longs[x])) |
|
| 39 | |||
| 40 | 1 | fig = px.scatter_mapbox( |
|
| 41 | lon=longs, lat=lats, hover_name=gps_photos, title="Geo Locations" |
||
| 42 | ) |
||
| 43 | 1 | fig.update_layout(mapbox_style="open-street-map", title_x=0.5) |
|
| 44 | |||
| 45 | return fig |
||
| 46 |