-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON tour guide #147
JSON tour guide #147
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks great. Please check comments.
Screen.Recording.2024-08-27.at.14.07.22.mov |
Just for reference, here is how to fetch places using the Google Places API, notice that it requires an API_KEY import requests
def get_points_of_interest(api_key, latitude, longitude, radius=1000):
base_url = "https://places.googleapis.com/v1/places:searchNearby"
params = {
"maxResultCount": 10,
"locationRestriction": {
"circle": {
"center": {
"latitude": latitude,
"longitude": longitude},
"radius": radius
}
}
}
response = requests.post(base_url, json=params, headers={
"X-Goog-Api-Key": api_key,
"X-Goog-FieldMask": "places.displayName,places.location,places.googleMapsUri"}
)
if response.status_code == 200:
results = response.json()
return results["places"]
else:
return f"Error: {response.status_code}, {response.text}"
# Usage example
api_key = ""
latitude = "-8.0633014"
longitude = "-34.8729361"
response = get_points_of_interest(api_key, latitude, longitude)
print(response) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Partial work related to #28
OSMAPI was tentatively being used, but it's highly likely you'll need to use https://github.com/mvexel/overpass-api-python-wrapper instead.