Hi there! For my academic project, I want to calculate the current amount of charging stations in the Dutch city of Amsterdam. Before I can make that calculation, I first want to view all charging stations in Amsterdam. Unfortunately, am not succeeding in accomplishing this. I tried to use “Amsterdam” as a query in the API url:
import requests
import pandas as pd
import json
key = “****”
countrycode = “NL”
url = f"https://api.openchargemap.io/v3/poi/?key={key}?output=json&countrycode={countrycode}&town=amsterdamt&compact=true&verbose=false"
parameters = {
key: “****”,
countrycode: “NL”
}
response = requests.get(url, params=parameters)
json_response = json.loads(response.content)
data = response.json()
print(data)
My response is a JSON file with a random amount of Dutch cities, but not filtered by “Amsterdam”.
Thanks in advance!
Hi, we don’t have a town filter but if you can provide a simplified polygon
(encoded as a polyline like Utilitário codificador interativo de polilinha | Plataforma Google Maps | Google Developers) for the area then that would work. See our API documentation: https://openchargemap.org/site/develop/api#/operations/get-poi you would provide the encoded polyline as polygon=<encoded polyline>
in the query URL. Alternatively you can use a bounding box or a search around a latitude/longitude with a given radius then filter the results yourself. Addresses are approximate information and may be incomplete.
1 Like