Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Build an Interactive Website Google Maps Integration Adding Static Maps

Address for Google Maps / Key problem

Hi! I'm adding a static map following the video but when we get to the part of the address in the URL:

```<img src="http://maps.googleapis.com/maps/api/staticmap?key=AIzaSyAEVECnSAjjzhDbP9Ryd-crOmaF5v9TguI&size=400x300&sensor=false&markers=ADDRESS" alt="">

I want to put a Mexican Address:

Boulevard Barra Vieja 1000
Acapulco, Guerrero
Mรฉxico

I'm trying like this:

   ```<img src="http://maps.googleapis.com/maps/api/staticmap?key=AIzaSyAEVECnSAjjzhDbP9Ryd-crOmaF5v9TguI&size=400x300&sensor=false&markers=Boulevard+Barra+Vieja+1000+Acapulco+Mexico" alt="Boulevard Barra Vieja 1000, Acapulco, Mรฉxico">

But it doesn't work. Can anyone help me, please?

4 Answers

The only way it worked was to create a new Google Account and generate a new key... obviously is not the best solution but I didn't find anything else.

Christopher Romero
Christopher Romero
8,564 Points

Hi Sofia, It looks like the "key" portion of your url is creating the issue. If remove that section from the url the map displays properly: http://maps.googleapis.com/maps/api/staticmap?size=400x300&sensor=false&markers=Boulevard+Barra+Vieja+1000+Acapulco+Mexico

Ok, thanks! So.. I don't need the key? Without it it'll work fine?

Christopher Romero
Christopher Romero
8,564 Points

I'm a little fuzzy the Google Maps API, but the map appears to display without using the key. If you want to look into it further you may want to take a look at the settings in your API console. Here is a Stackoverflow post that may point you in the right direction: http://stackoverflow.com/questions/19408066/the-google-maps-api-server-rejected-your-request

It doesn't work with the key... I need it for the map to be interactive, right?

I tried with a new key but Google didn't allow it, I checked that the Referers is to "Any referer allowed", I have the "Key for browser apps"... Help!