fschwartzer commited on
Commit
c9c2156
1 Parent(s): efca6f0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -10
app.py CHANGED
@@ -4,11 +4,7 @@ import numpy as np
4
  from geopy.distance import geodesic
5
 
6
  # Create a DataFrame with sample data
7
- data = pd.DataFrame({
8
- 'lat': np.random.uniform(-90, 90, 1000),
9
- 'lon': np.random.uniform(-180, 180, 1000),
10
- 'value': np.random.rand(1000) * 100
11
- })
12
 
13
  # Function to calculate distance in meters between two coordinates
14
  def calculate_distance(lat1, lon1, lat2, lon2):
@@ -19,10 +15,10 @@ def calculate_distance(lat1, lon1, lat2, lon2):
19
  # Create a sidebar for controls
20
  with st.sidebar:
21
  # Display a title
22
- st.title('Geospatial Dashboard')
23
 
24
  # Dropdown to select specific coordinates
25
- selected_coords = st.selectbox('Select Coordinates', ['Random', 'Custom'])
26
  if selected_coords == 'Custom':
27
  custom_lat = st.number_input('Enter Latitude', value=0.0)
28
  custom_lon = st.number_input('Enter Longitude', value=0.0)
@@ -30,14 +26,14 @@ with st.sidebar:
30
  custom_lat, custom_lon = 0.0, 0.0
31
 
32
  # Slider for setting the zoom level
33
- zoom_level = st.slider('Zoom Level', min_value=1, max_value=15, value=5)
34
 
35
  # Slider to set the radius in meters
36
- radius_in_meters = st.slider('Select Radius (in meters)', min_value=100, max_value=5000, value=1000)
37
 
38
  # Filter data based on the radius
39
  if selected_coords == 'Custom':
40
- filtered_data = data[data.apply(lambda x: calculate_distance(x['lat'], x['lon'], custom_lat, custom_lon), axis=1) <= radius_in_meters]
41
  else:
42
  filtered_data = data
43
 
 
4
  from geopy.distance import geodesic
5
 
6
  # Create a DataFrame with sample data
7
+ data = pd.read_excel('ven_ter_fim_PEDÓ.xlsx')
 
 
 
 
8
 
9
  # Function to calculate distance in meters between two coordinates
10
  def calculate_distance(lat1, lon1, lat2, lon2):
 
15
  # Create a sidebar for controls
16
  with st.sidebar:
17
  # Display a title
18
+ st.title('avalia.se')
19
 
20
  # Dropdown to select specific coordinates
21
+ selected_coords = st.selectbox('Selecione Coordenadas', ['Random', 'Custom'])
22
  if selected_coords == 'Custom':
23
  custom_lat = st.number_input('Enter Latitude', value=0.0)
24
  custom_lon = st.number_input('Enter Longitude', value=0.0)
 
26
  custom_lat, custom_lon = 0.0, 0.0
27
 
28
  # Slider for setting the zoom level
29
+ zoom_level = st.slider('Nível de zoom', min_value=1, max_value=15, value=5)
30
 
31
  # Slider to set the radius in meters
32
+ radius_in_meters = st.slider('Selecione raio (em metros)', min_value=100, max_value=5000, value=1000)
33
 
34
  # Filter data based on the radius
35
  if selected_coords == 'Custom':
36
+ filtered_data = data[data.apply(lambda x: calculate_distance(x['Latitude'], x['Longitude'], custom_lat, custom_lon), axis=1) <= radius_in_meters]
37
  else:
38
  filtered_data = data
39