Skip to content
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

Merged
merged 10 commits into from
Aug 28, 2024
Merged

JSON tour guide #147

merged 10 commits into from
Aug 28, 2024

Conversation

amandasavluchinske
Copy link
Contributor

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.

@filipeximenes filipeximenes marked this pull request as ready for review August 27, 2024 14:35
@filipeximenes filipeximenes requested review from pamella and fjsj August 27, 2024 14:35
example/demo/views.py Outdated Show resolved Hide resolved
Copy link
Member

@fjsj fjsj left a 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.

@filipeximenes
Copy link
Contributor

Screen.Recording.2024-08-27.at.14.07.22.mov

@filipeximenes filipeximenes requested review from fjsj and pamella August 27, 2024 17:10
@filipeximenes
Copy link
Contributor

filipeximenes commented Aug 27, 2024

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)

@fjsj fjsj changed the title Pushes partial work related to JSON tour guide JSON tour guide Aug 27, 2024
Copy link
Collaborator

@pamella pamella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :octocat:

@filipeximenes filipeximenes merged commit b9f6ec0 into main Aug 28, 2024
18 checks passed
@filipeximenes filipeximenes deleted the feat/json-tour-guide branch August 28, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants