Yes I should have provided some code.
Here is the solution in python:
def search_nearby_features(latitude, longitude, radius):
overpass_url = "https://overpass-api.de/api/interpreter"
query = f"""
[out:json];
(
node(around:{radius},{latitude},{longitude});
way(around:{radius},{latitude},{longitude});
relation(around:{radius},{latitude},{longitude});
);
out center;
"""
params = {
"data": query
}
response = requests.get(overpass_url, params=params)
if response.status_code == 200:
data = response.json()
return data["elements"]
else:
print("Error occurred:", response.text)
return []
def get_node_points(nearby_features):
nodes = []
for point in nearby_features:
if point['type'] == 'node':
nodes.append(point)
return nodes
just have to pick a lat, long and r values and then run:
nearby_features = search_nearby_features(latitude, longitude, radius)
nodes = get_node_points(nearby_features)
print(f"number of points\locations in a radius of {radius} meters from the given coordinates: {len(nodes)}")
note that I look specifically for type=='node' because these are address locations as far as I understood. I dont care about roads etc.