Zeel commited on
Commit
c4c39eb
·
1 Parent(s): 210106d

view on google maps

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -118,8 +118,9 @@ if file_url:
118
  # | Area (ha) | {stats_df['Area (ha)'].item():.2f} ha|
119
  # | Perimeter (m) | {stats_df['Perimeter (m)'].item():.2f} m |"""
120
  # unsafe_allow_html=True)
121
- centroid_x = stats_df["Centroid"].item().xy[0][0]
122
- centroid_y = stats_df["Centroid"].item().xy[1][0]
 
123
  st.markdown(
124
  f"""
125
  <div style="display: flex; justify-content: center;">
@@ -128,10 +129,14 @@ if file_url:
128
  <th>Metric</th>
129
  <th>Value</th>
130
  </tr>
131
- <tr>
132
- <td>Centroid</td>
133
- <td>({centroid_x:.5f}, {centroid_y:.5f})</td>
134
- <tr>
 
 
 
 
135
  <td>Area (ha)</td>
136
  <td>{stats_df['Area (ha)'].item():.2f} ha</td>
137
  </tr>
 
118
  # | Area (ha) | {stats_df['Area (ha)'].item():.2f} ha|
119
  # | Perimeter (m) | {stats_df['Perimeter (m)'].item():.2f} m |"""
120
  # unsafe_allow_html=True)
121
+ centroid_lon = stats_df["Centroid"].item().xy[0][0]
122
+ centroid_lat = stats_df["Centroid"].item().xy[1][0]
123
+ centroid_url = f"https://www.google.com/maps/@?api=1&map_action=map&center={centroid_lat},{centroid_lon}&zoom=18&layer=satellite"
124
  st.markdown(
125
  f"""
126
  <div style="display: flex; justify-content: center;">
 
129
  <th>Metric</th>
130
  <th>Value</th>
131
  </tr>
132
+ <td>Centroid</td>
133
+ <td>
134
+ ({centroid_lon:.5f}, {centroid_lat:.5f})
135
+ <a href="https://www.google.com/maps/@?api=1&map_action=map&center={centroid_lat:.5f},{centroid_lon:.5f}&zoom=12&layer=satellite" target="_blank">
136
+ <button>View on Google Maps</button>
137
+ </a>
138
+ </td>
139
+ </tr>
140
  <td>Area (ha)</td>
141
  <td>{stats_df['Area (ha)'].item():.2f} ha</td>
142
  </tr>