Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea to synchronize & visualize the data? #5

Open
julianguttzeit opened this issue Oct 13, 2022 · 3 comments
Open

Idea to synchronize & visualize the data? #5

julianguttzeit opened this issue Oct 13, 2022 · 3 comments

Comments

@julianguttzeit
Copy link

Hi fjxmlzn & folks,

I am impressed with your script! I installed it on a MAC VM on a Unraid server & it works great. In fact, I had a break-in the other day and was able to track down the stolen goods using the airtags!

But now I was looking for a solution to save the history. Your script is great for this.

The question now is, how to visualize the data best (live). In the case of a theft, it is of course a bit more complicated to make maps of all days, etc.. manually.

Grandios would be a map where you can select the times to display the positions. I have done this with Mapbox, Atlist Maps and Google My Maps. However, not yet with a live ingest. Now I thought about synchronizing the CSV data with a Google Spreadsheet and then loading it into a map. This works. But it is very uncomfortable.

Do you have an idea for an approach how to visualize the data best? If possible even "live"? So that the data is automatically synchronized. I would have thought about writing the CSV data into a MySQL database or converting it into json etc... To synchronize with a server. However, I have not quite found which MAP could be suitable for this.

I would be very grateful for any approach or idea. If I find a way in the meantime I would of course post it here.

Best
Julian

@fjxmlzn
Copy link
Owner

fjxmlzn commented Oct 13, 2022

That's a great proposal! I will look into it and share it here when I have time and feel free to post ideas/approaches or make pull requests about it.

@bkarakashev
Copy link

Hi @julianguttzeit @fjxmlzn,

Excellent project, it all works great.
Can you help me visualize the data from the CSV file even manually?
Can I use the CSV file the way it is or would I need to format it?

What tools are you using to visualize the data?

Thanks

@joshelboy
Copy link

I wrote a separate little script for this.
If someone (including me) has some spare time... He/she could beautify this, add a cron job... Maybe a timeline for historical heatmaps and buttons for this. Just as a thought. I might do a PR in the next couple of weeks

import pandas as pd
import folium
from folium.plugins import HeatMap

# Read CSV
df = pd.read_csv('./log/2023-07-20/AIRTAG_SN.csv')
df['location|latitude'] = df['location|latitude'].astype(float)
df['location|longitude'] = df['location|longitude'].astype(float)

# Create map around avg lat/long
average_lat = df['location|latitude'].mean()
average_lon = df['location|longitude'].mean()
m = folium.Map([average_lat, average_lon], zoom_start=10)

heat_data = [[row['location|latitude'], row['location|longitude']] for index, row in df.iterrows()]

# heatmap layer
HeatMap(heat_data).add_to(m)

# last known location
last_lat = df['location|latitude'].values[-1]
last_lon = df['location|longitude'].values[-1]

# marker with a cat emoji at the last known location
folium.Marker(
    [last_lat, last_lon],
    icon=folium.DivIcon(html=f"""<div style="font-size:24pt">&#128008;</div>""")
).add_to(m)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants