Optimizing site selection for EV charging stations

Using Spatial Indexes to pinpoint areas for expansion

In this tutorial, you will learn how to optimize the site selection process for EV charging stations at scale. While this guide focuses on EV charging stations, you can adapt this process to optimize site selection for any service or facility.

You will need...

  • A subscription to the USA H3 Spatial Features dataset (free) from our Spatial Data Catalog. You can replace this with any Spatial Index dataset that includes a population field.

  • A subscription to the OpenStreetMap places dataset, available for all countries in the Spatial Data Catalog. If you're following our example, you'll want to use the USA version.

  • Electric Vehicle charging location data. Our example uses data downloaded from the National Renewable Energy Laboratory here. Prior to following the tutorial, you'll need to load this data into your cloud data warehouse.

Step 1: Identifying areas of high demand for EV charging locations

In this first step of this tutorial, we'll be building the workflow below to understand where has the highest likely demand for EV charging locations in the USA. We will do this by identifying which H3 cells are furthest from an existing charging location, but also have a high population.

  1. First, log into the CARTO Workspace and Create a new workflow and Select a Connection (this should be to wherever you have loaded the EV charging location data).

  2. Drag the EV charging location data onto the map. 💡 If the table doesn't include a geometry field, use ST GeogPoint to create point geometries from the latitude and longitude columns.

  3. Next, drag the H3 population data onto the canvas. The H3 Spatial Features table from the Spatial Data Catalog contains a vast number of fields. To make your life easier, you may wish to instead use the Select component to only select the fields of interest, using the SQL "SELECT geoid AS h3, population FROM..."

  4. We first need to calculate the distance from each H3 cell to its closest charging location:

    1. Use H3 Center to convert each H3 cell to a point geometry.

    2. Use ST Distance to calculate the distance from each H3 cell to the closest EV charging station.

  5. Next, use a Simple Filter to filter out any H3 cells which are closer than 4 km to an EV charging station, assuming that these locations are already well served for vehicle charging.

  6. Next, Join the results of this filter to the input H3 selection to access its population data.

  7. Finally, the BigQuery SQL PERCENTILE_CONT() function is used in a Custom SQL Select to select only areas with a high population (>97th percentile). You can see the SQL used to perform this below - note we can use placeholders like $a to call other components in the workflow.

  stats AS (
	nearest_distance AS percentile,
	PERCENTILE_CONT(population_joined, 0.97) OVER() AS percentile_97
  population_joined >= percentile_97

The result of this workflow should be a H3 grid covering all areas further than 4km from a charging station, and the 97th population percentile. Select the final Custom SQL Select component, open the map preview on the bottom of the screen then select Create Map to explore your results.

Section 2: Pinpointing potential EV charging locations

Now we know areas of likely high demand for EV charging locations, we can identify possible infrastructure which could accomodate future charging locations such as gas stations, hotels or parking lots.

To do this, we'll extend the workflow we created above.

  1. First, drag the “OSM places” layer onto your canvas.

  2. As your workflow is starting to become more complex, consider adding annotations to keep it organized.

  3. First, convert the OSM Places to a H3 index using H3 from GeoPoint.

  4. Secondly, use an inner Join is used to join the H3 cells to the result of Custom SQL Select from earlier; this will retain only "places" within these high demand areas. This process acts a lot like a Spatial Filter, but as we are using Spatial Indexes there is no geometry processing required, making the process much faster and more efficient.

The results of this are a query containing only infrastructure in areas of high demand for EV charging - perfect locations for future charging infrastructure!

Continue learning...

Learn more about how this analysis can be used in the blog post below.

Last updated