/browse EV Charging Stations using HERE Geocoding and Search API
In the previous blog, we delved into the intricacies of using the /discover
endpoint of the Geocoding and Search API to search for Points of Interest (POIs). In this blog, we are shifting gears to explore a new facet of location-based searches – finding Electric Vehicle (EV) charging stations. We will uncover how to leverage the power the /browse
endpoint in the Geocoding and Search API to pinpoint these essential charging spots on the map.
Browse Endpoint
The /browse endpoint provides a structured search by filtering items by category and name at a given geo-position in a radius of 250km. Items returned are places, streets, or localities, ranked by increasing distance. The Search center is defined by the geo-position specified in the input query parameter at
. Items distances are calculated with respect to this search center.
Additionally to the implicit filter of 250km around the search center, /browse
supports 2 additional geographic filters through the query parameter in
:
- a circle through the
in
parameter typecircle
- a bounding box through the
in
parameter typebbox
- a list of upper-case ISO 3166-1 alpha-3 country codes through the
in
parameter typecountryCode
HERE Places Category
/browse
allows you to retrieve places at a given position for a specific HERE Places category or HERE Places cuisine. For the purpose of EV charging station, we are going to use HERE Places category, HERE Places categories can be specified as values for the categories
field at any of their 3 levels:
- level 1 for a high level (ex:
700
for places of business and services) - level 2 for intermediate granularity (ex:
700-7600
for fueling station places) or - level 3 for fine-grained categories (ex:
700-7600-0322
for EV charging station places or700-7600-0325
for EV battery swap station places),
Sample Request
For example, browsing EV charging station and EV battery swap station, and using the category id 700-7600-0322,700-7600-0325
as value for the categories
parameter of a /browse
query:
GET https://browse.search.hereapi.com/v1/
browse
?at=45.52,-122.68
&limit=20
&categories=700-7600-0322,700-7600-0325
&apiKey={YOUR_API_KEY}
Response
The expected result for this query would be the following:
{
"items": [{
"title": "Tesla",
"id": "here:pds:place:840c20fbqenk6-aGVyZS1ldjplY29tb3ZlbWVudDoxNDUzNjMyNjk2",
"language": "en",
"resultType": "place",
"address": {
"label": "Tesla, 750 SW Alder St, Portland, OR 97205, United States",
"countryCode": "USA",
"countryName": "United States",
"stateCode": "OR",
"state": "Oregon",
"county": "Multnomah",
"city": "Portland",
"district": "Downtown",
"street": "SW Alder St",
"postalCode": "97205",
"houseNumber": "750"
},
"position": {
"lat": 45.51999,
"lng": -122.68005
},
"access": [{
"lat": 45.52019,
"lng": -122.67994
}],
"distance": 4,
"categories": [{
"id": "700-7600-0322",
"name": "EV Charging Station",
"primary": true
}],
"chains": [{
"id": "25875",
"name": "Tesla"
}],
"contacts": [{
"phone": [{
"value": "+18777983752"
}],
"www": [{
"value": "https://www.tesla.com"
}]
}]
},
... // more items
]
}
HERE Maps API for Javascript Implementation
To implement this using the same HERE Maps API for Javascript sample application from the previous blog, the code would change to something like this:
function browseGeocode(platform) {
var geocoder = platform.getSearchService(),
browseParameters = {
categories: '700-7600-0322,700-7600-0325',
at: '45.52,-122.68',
limit: 20
};
geocoder.browse(
browseParameters,
onSuccess,
onError
);
}
Sample Application
Below is the sample application using the same codebase as the previous blog using the above code. You can access the source code in this Github repo.
Cruising Along the route
And the journey doesn't stop there. If you are eager to reveal EV charging stations along your route, /browse
like /autosuggest
and /discover
supports search along the route through the addition of a route
parameter to the at
parameter. For detailed implementation steps, dive into Implementing Search along the route for specifics.
Have your say
Sign up for our newsletter
Why sign up:
- Latest offers and discounts
- Tailored content delivered weekly
- Exclusive events
- One click to unsubscribe