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