Spaces:
Sleeping
Sleeping
fschwartzer
commited on
Commit
•
6ee2207
1
Parent(s):
6fc7f17
Update app.py
Browse files
app.py
CHANGED
@@ -147,10 +147,14 @@ with st.sidebar:
|
|
147 |
custom_address = st.text_input('Informe o endereço', custom_address_initial)
|
148 |
radius_visible = True # Show radius slider for custom coordinates
|
149 |
|
150 |
-
# Geocode the custom address using the Google Maps API
|
151 |
gmaps = googlemaps.Client(key='AIzaSyDoJ6C7NE2CHqFcaHTnhreOfgJeTk4uSH0') # Replace with your API key
|
152 |
|
153 |
try:
|
|
|
|
|
|
|
|
|
|
|
154 |
location = gmaps.geocode(custom_address)[0]['geometry']['location']
|
155 |
custom_lat, custom_lon = location['lat'], location['lng']
|
156 |
except (IndexError, GeocoderTimedOut):
|
|
|
147 |
custom_address = st.text_input('Informe o endereço', custom_address_initial)
|
148 |
radius_visible = True # Show radius slider for custom coordinates
|
149 |
|
|
|
150 |
gmaps = googlemaps.Client(key='AIzaSyDoJ6C7NE2CHqFcaHTnhreOfgJeTk4uSH0') # Replace with your API key
|
151 |
|
152 |
try:
|
153 |
+
# Ensure custom_address ends with " - RS, Brazil"
|
154 |
+
custom_address = custom_address.strip() # Remove leading/trailing whitespaces
|
155 |
+
if not custom_address.endswith(" - RS, Brazil"):
|
156 |
+
custom_address += " - RS, Brazil"
|
157 |
+
|
158 |
location = gmaps.geocode(custom_address)[0]['geometry']['location']
|
159 |
custom_lat, custom_lon = location['lat'], location['lng']
|
160 |
except (IndexError, GeocoderTimedOut):
|