I want to make code in Python in GIS to download POIs within a specific radius.
Can anyone check my code for the error? After running this code. The Result is only [].
import requests
import json
import os
import sys
from datetime import datetime
import xlrd
import time
# Set up API credentials
api_key = 'Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
# Define the location and radius
location = '39.169061,21.569649' 
radius = 100  # Radius in meters
# Send a request to the Nearby Search API
url = 'https://maps.googleapis.com/maps/api/place/nearbysearch/json?location={location}&radius={radius}&key={api_key}'
response = requests.get(url)
data = response.json()
# Process the API response
places = data['results']
while 'next_page_token' in data:
    next_page_token = data['next_page_token']
    url = 'https://maps.googleapis.com/maps/api/place/nearbysearch/json?location={location}&radius={radius}&key={api_key}&pagetoken={next_page_token}'
    response = requests.get(url)
    data = response.json()
    places.extend(data['results'])
# Save the data
with open('poi_data.json', 'w') as file:
    json.dump(places, file)
    
data['status']. developers.google.com/maps/documentation/places/web-service/…