Below is a conversation between the user and the assistant. Give a concise name for this…
- User
Below is a conversation between the user and the assistant. Give a concise name for this chat. Output ONLY the name of the chat (WITHOUT quotes) and NOTHING else.
User: write a function which uses folium map to plot multiple satellite groundtracks, each with a different color. It should use the timeline slider to show the orbit moving, assume lat lon data is already available Assistant: To create a function that uses Folium to plot multiple satellite ground tracks with different colors and includes a timeline slider to visualize the orbits moving, you can follow these instructions. This function assumes that you have the latitude and longitude data for multiple satellites available in a specific format. Below is a basic implementation using Folium and the
brancalibrary for color mapping.First, make sure to install the necessary libraries if you haven't done so:
pip install folium brancaThen, you can use the following code:
import folium import numpy as np import pandas as pd from folium.plugins import TimestampedGeoJson def plot_ground_tracks(lat_lon_data, satellite_names, timeline): """ Plots multiple satellite groundtracks on a Folium map with a timeline slider. Parameters: - lat_lon_data: Dictionary where keys are satellite names and values are lists of tuples (lat, lon, timestamp) - satellite_names: List of satellite names for which to plot the tracks - timeline: Time range for the timestamp slider """ # Initialize the Folium map m = folium.Map(location=[0, 0], zoom_start=2) # Define a color map for different satellites color_map = { 'Satellite 1': 'blue', 'Satellite 2': 'green', 'Satellite 3': 'red', 'Satellite 4': 'orange', 'Satellite 5': 'purple' } # Create GeoJSON features for each satellite features = [] for satellite in satellite_names: if satellite not in lat_lon_data: continue # Retrieving latitude, longitude, and timestamps data = lat_lon_data[satellite] # Add paths to features list with color coding features.append({ 'type': 'Feature', 'geometry': { 'type': 'LineString', 'coordinates': [(lon, lat) for lat, lon, timestamp in data] }, 'properties': { 'times': [timestamp.isoformat() for lat, lon, timestamp in data], # Ensure timestamps are in ISO format 'style': {'color': color_map.get(satellite, 'black')}, 'name': satellite } }) # Create the Timestamped GeoJson layer timestamped_geojson = TimestampedGeoJson( {'type': 'FeatureCollection', 'features': features}, period='PT1M', # Change the period as needed add_last_point=True, auto_play=True ) # Add the layer to the map m.add_child(timestamped_geojson) return m # Example usage if __name__ == "__main__": # Mock data: Replace this with your actual latitude, longitude, and timestamp data example_data = { 'Satellite 1': [(34.05, -118.25, pd.Timestamp('2023-01-01T00:00:00'))], 'Satellite 2': [(40.71, -74.01, pd.Timestamp('2023-01-01T00:00:10'))], 'Satellite 3': [(51.51, -0.13, pd.Timestamp('2023-01-01T00:00:20'))], 'Satellite 4': [(48.85, 2.35, pd.Timestamp('2023-01-01T00:00:30'))], 'Satellite 5': [(35.68, 139.76, pd.Timestamp('2023-01-01T00:00:40'))] } satellites = ['Satellite 1', 'Satellite 2', 'Satellite 3', 'Satellite 4', 'Satellite 5'] timeline = ['2023-01-01T00:00:00', '2023-01-01T00:00:50'] # Create the map folium_map = plot_ground_tracks(example_data, satellites, timeline) # Save map to HTML file folium_map.save("satellite_groundtracks.html") - Assistant
Satellite Groundtracks Visualization with Folium
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.