I have 39 different .shp files of the same locations but different data values and I need to output a map for each of them. Is there a way to build a map template and then run a process that will loop through each .shp file and output a map, either .pdf or .png, of the map template with the individual .shp files?
you can achieve this with the atlas function of QGIS. Let's say you have different themes with names 1..n. Then you have to make an additional pointtheme to control the atlas, e.g. called 'control'. Just put one point for each theme on the same coordinates into the control layer (copy and paste the same point from 1..n). Then put all the names of your 39 themes into the control layer into an attribute column. Then make an ATLAS with your maplayout and set the controllayer to your layer 'control'
At least use the data defined override to control the visiblity of the layers through our control layer. Just put the column name (in this example it is called ID, together with the atlasfeature into the expression builder:
Update: I figured out a good way to do this using the Basemap package in Python. I wrote up a tutorial that walks through how to plot several .shp files on different maps all with the same extent. It is posted at https://mapping-with-python.herokuapp.com/index.html
The essential components are to open a map object
map = Basemap2(llcrnrlon= LongLeft,llcrnrlat= LatBottom,urcrnrlon=LongRight,urcrnrlat=LatTop, projection='tmerc', lat_0 = midLat, lon_0 = midLong, epsg=3857)
and then to read in the .shp file you want to map