actions / actions/starter-workflows

pip install folium

Open
#3,080 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
12.1k
Forks
7.3k
PR merge metrics
No merged PRs in 30d

Description

import folium
import timeDuplicate of #3079

import datetime

--- 1. Fungsi untuk Mencatat Lokasi (Sama seperti sebelumnya) ---

def catat_lokasi(lintang, bujur):
"""Membuat objek lokasi (dictionary)."""
waktu_saat_ini = datetime.datetime.now().strftime("%H:%M:%S")
return {
"waktu": waktu_saat_ini,
"lintang": lintang,
"bujur": bujur
}

--- 2. Pembuatan Data Simulasi ---

riwayat_pergerakan = []

Lokasi 1: Jakarta

lokasi_1 = catat_lokasi(-6.200000, 106.816666)
riwayat_pergerakan.append(lokasi_1)

time.sleep(1)

Lokasi 2: Bogor

lokasi_2 = catat_lokasi(-6.597722, 106.806892)
riwayat_pergerakan.append(lokasi_2)

--- 3. Memvisualisasikan Data ke Peta dengan Folium ---

Tentukan koordinat pusat peta (kita ambil lokasi terbaru)

pusat_peta = [lokasi_2['lintang'], lokasi_2['bujur']]

Buat objek peta

zoom_start: level zoom (semakin besar angkanya, semakin dekat)

m = folium.Map(location=pusat_peta, zoom_start=10)

Tambahkan setiap lokasi sebagai penanda (marker) pada peta

for i, lokasi in enumerate(riwayat_pergerakan):
# Teks yang muncul saat pin diklik
popup_text = f"Lokasi {i+1}
Waktu: {lokasi['waktu']}"

# Tambahkan marker pada peta
folium.Marker(
    location=[lokasi['lintang'], lokasi['bujur']],
    popup=popup_text,
    tooltip=f"Titik {i+1}",
    # Gunakan ikon pin merah untuk lokasi terakhir
    icon=folium.Icon(color='red', icon='info-sign') if i == len(riwayat_pergerakan) - 1 else None
).add_to(m)

Simpan peta interaktif ke file HTML

file_html = "simulasi_pelacakan_map.html"
m.save(file_html)

print("\n---------------------------------------------------")
print("✅ Selesai! Peta telah dibuat.")
print(f"Silakan buka file '{file_html}' di browser web Anda.")
print("Anda akan melihat peta interaktif dengan pin di lokasi Jakarta dan Bogor.")
print("---------------------------------------------------")

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the duplicate reference to #3079 and the repository's issue context first; no file, test, or workflow entry point is named here. Done would require a distinct, actionable request rather than repeating #3079.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
5/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.