How to automate Googlemaps image capture: urban development ruins in Spain

Josh Begley developed a script that outputs a list of googlemaps images given a list of locations (longitud and latitude needed). It runs in Processing and uses the Google Maps API. It was originally used to get aerial images of all the prisons in the USA. I thought it could be interesting to get googlemaps images from all the urban developments that were built and unfinished during the real estate bubble in Spain. I’ve opened a spreadsheet with a few of them to test the script.

This is a side project to the 6.000km map, a kind of wiki to collect info about urban metabolism in the era of the real estate bubble in Spain. Soon, we will have updated photos of some of these places, that we just took in Madrid with balloon mapping techniques.

How to

Script in Processing (based on Josh Begley):

String[] paus;
void setup() {
void draw() {
paus = loadStrings("locations-latlon.csv");
for(int i = 0; i < paus.length; i++) {
String[] values = split(paus[i], ",");
String lat = values[0];
String lon = values[1];
String id = values[2];
PImage test = getSatImage(lat,lon); + ".jpg");
PImage getSatImage(String lat, String lon) {
String url = "" + lat + "," + lon + "&zoom=15&scale=1&size=640x640&maptype=satellite&sensor=false&junk=.jpg";

The locations-latlon.csv file should be in the same sketch folder. I downloaded the spreadsheet as a .csv (comma-separated value) file. I took the longitude/latitude data from OSM:, you can see it in the url bar once you click in the “permalink” (bottom right).

locations-latlon.csv file content:
40.39427,-3.5939,Vicalvaro extension
40.49239,-3.72772,Arroyo del Fresno
40.99801,-4.11742,La Encina (Bernuy de Porreros)
40.87828,-4.68457,Villanueva de Gomez. Ávila
38.79932,-4.07395,Villa Mayor de Calatrava. Ciudad Real
38.87209,-3.97485,Pologono Industrial aeropuerto Ciudad Real
39.0472,-3.92153,El Reino de Don Quijote

Once you run the processing script it will automatically generate all the .jpg files based on the locations-latlon.csv. Now it is easy to output different kinds of images with a few tweaks using the style feature of the googlemaps API. If we change the line:

String url = "" + lat + "," + lon + "&zoom=15&scale=1&size=640x640&maptype=satellite&sensor=false&junk=.jpg";
String url = "" + lat + "," + lon + "&zoom=15&scale=1&size=640x640&maptype=roadmap&sensor=false&junk=.png";

You’ll have to change also the line to autput a .png file id + ".jpg");
by id + ".png");

We have now the same tiles, but with the roadmap view. This has been been fun, but we are not using interesting features from the googlemaps API. We can go further, and, by using the element selection, we can adjust colors and visibility. We need to change the line again and add some styling code:

String url = "" + lat + "," + lon + "&zoom=15&scale=1&size=640x640&maptype=roadmap&sensor=false&style=feature:road%7Clement:labels.text

We are able to decide the color or visibility of every element in the map, in the same way we’d do with using OpenStreetMap as data provider. We are now ready to start a quiz of PAU (Plan de Actuación Urbanística) recognition. Pending: try the same with OSM data!

Thanks Charlie for the link to


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">