With my MBA program behind me, one of my goals has been to shake the rust off my coding and GIS skills. For this post, I thought I would start simply, just to make sure I remembered how to find my way around QGIS.
We recently purchased a plug-in hybrid. It has a 17-mile range when running fully electric, so I used this as the basis for a quick analysis with QGIS. Of course, any such experimentation isn’t much fun without a few unrealistic assumptions, so here they are:
- The car was parked with an empty tank.
- It was brought up to a full charge overnight.
- Rather than immediately going to a gas station, we’ll go to a charging to top off the battery again.
These assumptions are, of course, ridiculous, but they allow me to have some fun.
I decided to build out drive-distance isochrones representing ten miles and sixteen miles. Ten miles represented the safe range, and sixteen represented the edge of insanity, at which I should use the last mile to find a gas station.
First, I needed the locations of EV charging stations. The National Renewable Energy Laboratory (NREL) maintains a nice API of alternate fueling locations, which can be filtered down to EV charging stations. I needed an API key, but it was free and easy to get. I pulled the GeoJSON feed to QGIS and saved it to a geopackage. (No shapefiles were used in the making of this post.)
Next, I needed to generate the drive-distance polygons. After checking a few options, I settled on the ORS Tools plug-in for QGIS, which makes the various services of the Open Route Service (ORS) available through the QGIS toolbox. ORS also requires an API key, but it was also free and easy. I chose ORS mainly because it works completely online and didn’t require me to set up data locally and prep it for network analysis.
ORS Tools installs into the QGIS processing toolbox. To generate isochrones, simply expand the toolbox as shown here. For the analysis I wanted to do, I wanted to use “Isochrones from point” since I would be calculated driving distance from an origin point. Choosing this item in the toolbox will display a modal dialog box that allows me to enter the necessary parameters for generating the polygons. Before doing any of this, there is a prerequisite step to add your ORS API key to the plug-in, but that step is not covered here.
In the resulting dialog, I had to make a few choices. First, I set the travel mode to “driving-car.” Then I set the origin point by clicking on the map (use the ellipsis button to do that). I chose distance as the dimension, rather than time, since that’s how the car’s range is measured. As a result, the comma-separated values should represent the range “rings” in meters. The values I chose roughly correspond to 10 and 16 miles, respectively. With those settings in place, I clicked the “Run” button and waited a few seconds before the polygons appeared.
After that, some basic spatial analysis was needed to identify the charging. I used the Vector > Research Tools > Select by Location… menu combination to select the charging stations inside each range ring, creating a new layer from each selection. Once the selections were done, it was simply a matter of styling the layers to achieve the presentation at the top of this post.
It was fun to be able to dig back into some GIS with an admittedly-silly scenario. I’ve been looking for an excuse for a while and am happy to have time to put toward it again.