From 5b93e3d859378056ae01c6214d49226fa26d4920 Mon Sep 17 00:00:00 2001
From: AdvisoryFlown <120481326+GamingCentral@users.noreply.github.com>
Date: Fri, 29 Mar 2024 02:03:57 +0530
Subject: [PATCH 1/3] merge commit
---
Pinned_Locations.html | 450 +++++++++++++++++++++++++++++++
README.md | 1 +
__pycache__/cara.cpython-312.pyc | Bin 0 -> 292 bytes
__pycache__/maps.cpython-312.pyc | Bin 0 -> 1637 bytes
distance.py | 62 +++++
maps.py | 27 ++
police_stations.csv | 14 +
stepUpTimer.py | 0
8 files changed, 554 insertions(+)
create mode 100644 Pinned_Locations.html
create mode 100644 README.md
create mode 100644 __pycache__/cara.cpython-312.pyc
create mode 100644 __pycache__/maps.cpython-312.pyc
create mode 100644 distance.py
create mode 100644 maps.py
create mode 100644 police_stations.csv
create mode 100644 stepUpTimer.py
diff --git a/Pinned_Locations.html b/Pinned_Locations.html
new file mode 100644
index 0000000..2c9f6ed
--- /dev/null
+++ b/Pinned_Locations.html
@@ -0,0 +1,450 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..a898939
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+# codeCollab
\ No newline at end of file
diff --git a/__pycache__/cara.cpython-312.pyc b/__pycache__/cara.cpython-312.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..511282469e5b205be290b0e70c4bb98d2297ca15
GIT binary patch
literal 292
zcmX@j%ge<81fTm@)3ku}V-N=h7@>^MASKfoQW#noq8KU}HJOrODnK+d6n~ZiGNv<>
zz;rRBFs_EO85t@WG@1OWxHD37a`F}O5)<=EH5qTQ78GUXm8@j=3^L}IQL2KczG$)vkyG$c5|v
Qz|6?V_?d~3Q4*{c0D@gTB>(^b
literal 0
HcmV?d00001
diff --git a/__pycache__/maps.cpython-312.pyc b/__pycache__/maps.cpython-312.pyc
new file mode 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MYgv47NR9U@DoMVE$uLtlQu-;}i!#)v5^M+E;@R&77T{cSXi&W5Sf$#uC4?xcW
R2p^+fICR_(;Wg-`{srXQaOnU5
literal 0
HcmV?d00001
diff --git a/distance.py b/distance.py
new file mode 100644
index 0000000..96e1fcc
--- /dev/null
+++ b/distance.py
@@ -0,0 +1,62 @@
+import pandas as pd
+import math
+import maps
+
+# Function to calculate distance between two points using Haversine formula
+def haversine(lat1, lon1, lat2, lon2):
+ R = 6371.0 # Radius of the Earth in kilometers
+
+ lat1_rad = math.radians(lat1)
+ lon1_rad = math.radians(lon1)
+ lat2_rad = math.radians(lat2)
+ lon2_rad = math.radians(lon2)
+
+ dlon = lon2_rad - lon1_rad
+ dlat = lat2_rad - lat1_rad
+
+ a = math.sin(dlat / 2)**2 + math.cos(lat1_rad) * math.cos(lat2_rad) * math.sin(dlon / 2)**2
+ c = 2 * math.atan2(math.sqrt(a), math.sqrt(1 - a))
+
+ distance = R * c
+ return distance
+
+def getShortestDist(vLat,vLong):
+ victim_lat = vLat
+ victim_lon = vLong
+
+ # Load police stations data from CSV
+ police_stations = pd.read_csv("police_stations.csv") # Update with your CSV filename
+ police_locations = {}
+ # Calculate distances between victim and police stations
+ police_stations['distance'] = police_stations.apply(
+ lambda row: haversine(victim_lat, victim_lon, row['latitude'], row['longitude']),
+ axis=1
+ )
+
+ # Sort police stations by distance
+ sorted_police_stations = police_stations.sort_values(by='distance')
+
+ # Create list of dictionaries containing name, latitude, longitude, and distance
+ nearest_police_stations_list = []
+ for _, row in sorted_police_stations.iterrows():
+ police_station = {
+ 'name': row['name'],
+ 'latitude': row['latitude'],
+ 'longitude': row['longitude'],
+ 'distance': row['distance']
+ }
+ nearest_police_stations_list.append(police_station)
+
+ print("Nearest Police Stations:")
+ for police_station in nearest_police_stations_list:
+ print(f"{police_station['name']}: {police_station['distance']:.2f} km")
+
+ return victim_lat, victim_lon, nearest_police_stations_list
+
+if __name__=="__main__":
+ vlan,vlon,npsl = getShortestDist(17.3,78.5)
+ #dict = {ps1 : [lon, lat]}
+ dic = {}
+ for i in npsl:
+ dic[i['name']]=[i['latitude'],i['longitude']]
+ maps.show_map(17.3,78.5,dic)
diff --git a/maps.py b/maps.py
new file mode 100644
index 0000000..cc2ab1a
--- /dev/null
+++ b/maps.py
@@ -0,0 +1,27 @@
+import folium
+import webbrowser
+import os
+
+def pin_locations(lon, lan, locations_dict, map_title='Map'):
+ # Create a map centered at the first location
+ m = folium.Map(location=[lon, lan], zoom_start=15)
+
+ # Add red marker for the given lon, lan
+ folium.Marker(location=[lon, lan], popup='Pinned Location', icon=folium.Icon(color='red')).add_to(m)
+
+ # Add blue markers for each location in the dictionary
+ for key, value in locations_dict.items():
+ folium.Marker(location=value, popup=f'{key}: {value}', icon=folium.Icon(color='blue')).add_to(m)
+
+ # Save the map to an HTML file
+ file_path = map_title + '.html'
+ m.save(file_path)
+
+ # Open the HTML file using the default web browser
+ try:
+ webbrowser.open('file://' + os.path.realpath(file_path))
+ except Exception as e:
+ print("Unable to open HTML file:", e)
+
+def show_map(vlon, vlan, location_dict):
+ pin_locations(vlon, vlan, location_dict,'Pinned_Locations')
\ No newline at end of file
diff --git a/police_stations.csv b/police_stations.csv
new file mode 100644
index 0000000..50369ce
--- /dev/null
+++ b/police_stations.csv
@@ -0,0 +1,14 @@
+name,latitude,longitude
+bollarum Police Station,17.5183,78.5195
+quarters lingampally,17.499,78.316
+marredpally ps,17.4514,78.5054
+jubliee hills ps,17.4306,78.4091
+ramgopalpet ps,17.44,78.47
+gopalapuram ps,10.3738,79.4905
+lallaguda ps,17.4346,78.528
+tank bund ps,17.336,78.486
+Chikkadpally ps,17.4089,78.4974
+dcp west zone,17.38714,78.491684
+panjagutta ps,17.25,78.27
+ahmed nagar ps,18.2,73.9
+commissioner ahmed nagar ps,19.1068,74.7459
diff --git a/stepUpTimer.py b/stepUpTimer.py
new file mode 100644
index 0000000..e69de29
From 8b7f1a82d134aa8de25e9d9896f1dfd8b874dda3 Mon Sep 17 00:00:00 2001
From: AdvisoryFlown <120481326+GamingCentral@users.noreply.github.com>
Date: Wed, 29 May 2024 12:06:11 +0530
Subject: [PATCH 2/3] Update Pinned_Locations.html
---
Pinned_Locations.html | 236 +++++++++++++++++++++---------------------
1 file changed, 118 insertions(+), 118 deletions(-)
diff --git a/Pinned_Locations.html b/Pinned_Locations.html
index 2c9f6ed..37523f6 100644
--- a/Pinned_Locations.html
+++ b/Pinned_Locations.html
@@ -25,7 +25,7 @@