Playing With Maps

For today’s assignment I played around with the maps at Stamen. It took just a few minutes to get their basic map up and running, so I tried a few other things, which didn’t go as well.

First, I tried working with their Burning Map. I got really excited about this one when I saw it, but it looks like they didn’t make this particular style available and free to use. So, I took the code from their source code. I was able to get the map working, but I had trouble figuring out where to change the location.

Then, inspired by the burning example, I thought it would be interesting to try to map all of the places where the New York Times has written a story about “climate change” today. I have previously used the NYT API and Mapbox’s API for geolocation. Unfortunately, when I tried to reuse the code in this map, I ran into a number of problems. I was able to debug most of them (The most annoying was that one of my global variables “location” was being used by one of my libraries and was redirecting the page every time I loaded it. I eventually solved it by renaming my variable.), but then I ran into one I still haven’t been able to figure out.

The issue is that I’m able to get information about a location from the Mapbox API, but unfortunately the longitude and latitude data is not there. I’m not sure if it’s something that I’m doing wrong, or if Mapbox changed its free plan because I’m getting a “forbidden” error on their libraries.

Error that I’m getting with Mapbox geolocation.

Since Mapbox wasn’t working, I decided to try to see if I could use the Google Maps API. I signed up for that, but my API key wasn’t working with my search. At that point, I figured, I’d hold off on finishing the map. I have a feeling we’re going to get into this in class sometime soon anyway!

Anyway, here’s the live example, where I used the Stamen API and changed the location to Maputo. Take a look at the console to see how far I got with the APIs.