Open Charge Map
Open Charge Map is an open source and free data solution which provides charging station data for electric vehicles. They have a great API showing the POI addresses of charge stations that can be used to locate these stations.
Here is a simply code that uses requests, json libraries:
Here is a simply code that uses requests, json libraries:
import requests
import json
params = {"latitude": 40.79, "longitude": -73, "countrycode": "US",
"output": "json", "compact": True, "verbose": False, "maxresults": 20}
f = r'https://api.openchargemap.io/v3/poi/?'
data = requests.get(f, params = params)
a = data.text
a = json.loads(a)
print(a)
for i in a:
try:
print(i)
print(i["AddressInfo"]["StateOrProvince"])
print(i["AddressInfo"]["Title"])
print(i["AddressInfo"]["AddressLine1"])
print(i["AddressInfo"]["Town"])
print(i["AddressInfo"]["Postcode"])
print(i["AddressInfo"]["StateOrProvince"], "\n")
except Exception:
pass
Here is an example of the data that’s returned from Open Charge Map API:
Phone: 631-473-1550
Access: Dealership business hours
Website:
Title: Ramp Ford
Address: 4869 Nesconset Hwy
Port Jefferson Station 11776 NY
Phone: 888-758-4389
Access: 24 hours daily
Website: http://www.chargepoint.com/
Title: K&H STATION 1
Address: 66 Southern Blvd
Nesconset 11767 NY
Phone: 888-758-4389
Access: 24 hours daily
Website: http://www.chargepoint.com/
Title: COMPETITION BMW
Address: 599 Jericho Turnpike
Smithtown 11787 NY
Phone: (631) 361-9696
Phone: 516-686-1007
Phone: 866-816-7584
Access: 24 hours daily
Website: http://evconnect.com/
Title: Stony Brook University
Address: 100 Nicolls Rd
Stony Brook 11794 NY
Phone: 888-758-4389
Access: 24 hours daily
Website: http://www.chargepoint.com/
Title: DONALDSONVW
Address: 5700 Sunrise Hwy
Sayville 11782 NY
Phone: 888-758-4389
Access: 24 hours daily
Website: http://www.chargepoint.com/
Title: SCCC
Address: 580-586 College Rd
Farmingville 11738 NY
Phone: 888-758-4389
Access: 24 hours daily
Website: http://www.chargepoint.com/
Title: MIDDLE COUNTRY
Address: 575 Middle Country Rd
Selden 11784 NY
Phone: 631-750-9454
Access: 9am-5pm M-F
Website:
Title: SUNation Solar Systems
Address: 171 Remington Blvd
Ronkonkoma 11779 NY
Here are more parameters you can use while making a call to Open Charge Map API.
SERVICE PARAMETERS:
PARAMETER | DESCRIPTION | DEFAULT |
---|---|---|
output | json, xml, csv JSON format is recommended as highest fidelity | json |
maxresults | limit on max number of results returned | 100 |
countrycode | GB, US etc. Single ISO Country Code. | (blank) |
countryid | exact match on a given numeric country id (comma separated list) | (blank) |
latitude | latitude reference for distance calculation | (blank) |
longitude | longitude reference for distance calculation | (blank) |
distance | return results based on specified distance from specified latitude/longitude | (blank) |
distanceunit | Miles or KM | Miles |
operatorid | exact match on a given EVSE operator id (comma separated list) | (blank) |
connectiontypeid | exact match on a given connection type id (comma separated list) | (blank) |
levelid | exact match on a given charging level (1-3) id (comma separated list) | (blank) |
minpowerkw | minimum output power in kW (this information is not known for many locations) | (blank) |
usagetypeid | exact match on a given usage type id (comma separated list) | (blank) |
statustypeid | exact match on a given status type id (comma separated list) | (blank) |
dataproviderid | exact match on a given data provider id id (comma separated list). Use opendata=true for only OCM provided (“Open”) data. | (blank) |
modifiedsince | POIs modified since the given date (UTC) e.g. 2016-09-15T09:30 | (blank) |
opendata | true or false. Set to true to include only Open Data licensed content, false to return only non-open licensed data. By default all available data is returned. You should refer to the license of the original data provider in each case. | (blank) |
includecomments | true or false. Set to true to also include user comments and media items (photos) per charging location. | false |
verbose | true or false. Set to false to get a smaller result set with null items removed. | true |
compact | true or false. Set to true to remove reference data objects from output (just returns IDs for common reference data such as DataProvider etc). | false |
camelcase | true or false. Set to true to get a property names in camelCase format. | false |
callback | specify the name of the JSONP callback (if required), JSON response type only. | (blank) |
chargepointid | exact match on a given POI id (comma separated list). | (blank) |
Additionally from v3 of the API onwards you can query using a bounding box, polygon or polyline (for a route etc).
PARAMETER | DESCRIPTION | DEFAULT |
---|---|---|
boundingbox | specify top left and bottom right box corners as: (lat,lng),(lat2,lng2) | (blank) |
polygon | Specify an encoded polyline for the polygon shape. Polygon will be automatically closed from the last point to the first point. | (blank) |
polyline | encoded polyline, use with distance param to increase search distance along line. Polyline is expanded into a polygon to cover the search distance. | (blank) |
Open Charge Map is a free, public database that grows with volunteer efforts contributions of the community.
If you’d like to contribute to this project you can do so by contacting them here.
or check out their funding page here.
Source of API: Open Charge Map
If you need a refresher on user defined functions lesson in Python here is a link to our Defining Functions Lesson.
You can see our lesson about try and except statements here.