0

I have a project that developed using Python-Flask which can find all nearby clothes shop places using Google Maps.
so far i can do that with my code, but my current position i got from my IP Address, which that IP from the Internet Service Provider, so.. i dont want it.. because the internet service provider not too close to my location, i want more accurate position that can get current user GPS..
but so far.. i din't get the tutorial or source to get that using python flask..
so my questions.. Can flask to do that..? , if not..what's the others solution to do that..?

Here's my code to get my current ISP location and find all nearby places:

import googlemaps
import geocoder
from googleplaces import GooglePlaces, types

# you can get the API KEY here:
# https://developers.google.com/console
API_KEY = 'MY_API_KEY'

gmaps = googlemaps.Client(key=API_KEY)
locations = gmaps.geolocate()

latitude = locations['location']['lat']
longitude = locations['location']['lng']

g = geocoder.google([latitude, longitude], method='reverse')

get_json_values = g.json

my_current_position = get_json_values['address']

google_places = GooglePlaces(API_KEY)

query_result = google_places.nearby_search(
    location=my_current_position,
    keyword='baju', radius=3200)

for place in query_result.places:
    print(place.name)
    place.get_details()
    print(place.url)
Tri
  • 2,722
  • 5
  • 36
  • 65

0 Answers0