162

I'm trying to create a simple html page (I'd later like to add an autocomplete input there) that include google-places-api. I have an api-key (which is enabled) but I still get an error message.

Here is my html-

<head>
    <meta charset="utf-8">
    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=MY_KEY&libraries=places"></script>
    <title>test</title>
</head>
<body>
</body>

but I get this error message- enter image description here

and in the console I get - Google Maps API error: Google Maps API error: ApiNotActivatedMapError

I can't understand what the problem is.. Appreciate anybody's help

Jordi Castilla
  • 26,609
  • 8
  • 70
  • 109
Roy
  • 2,638
  • 3
  • 16
  • 12

6 Answers6

348

To enable Api do this

  1. Go to API Manager
  2. Click on Overview
  3. Search for Google Maps JavaScript API(Under Google Maps APIs). Click on that
  4. You will find Enable button there. Click to enable API.

OR You can try this url: Maps JavaScript API

Hope this will solve the problem of enabling API.

Adi
  • 4,766
  • 3
  • 20
  • 22
106

Assuming you already have a application created under google developer console, Follow the below steps

  1. Go to the following link https://console.cloud.google.com/apis/dashboard? you will be getting the below page enter image description here
  2. Click on ENABLE APIS AND SERVICES you will be directed to following page enter image description here
  3. Select the desired option - in this case "Maps JavaScript API"
  4. Click ENABLE button as below, enter image description here

Note: Please use a server to load the html file

codfish555
  • 96
  • 1
  • 15
Aravind
  • 40,391
  • 16
  • 91
  • 110
29

as of Jan 2017, unfortunately @Adi's answer, while it seems like it should work, does not. (Google's API key process is buggy)

you'll need to click "get a key" from this link: https://developers.google.com/maps/documentation/javascript/get-api-key

also I strongly recommend you don't ever choose "secure key" until you are ready to switch to production. I did http referrer restrictions on a key and afterwards was unable to get it working with localhost, even after disabling security for the key. I had to create a new key for it to work again.

JasonS
  • 7,443
  • 5
  • 41
  • 61
  • 3
    the get key from this 1 link finally created a working key for me. ty. all the other links i clicked to get key would get me the same non working one :S – bia.migueis Feb 15 '17 at 07:39
  • 1
    @bia.migueis I affirm (Apr 2018). Tried getting a new key several times and all gave ApiNotActivatedMapError. This link worked (although I thought I'd been there before, so maybe one has to just keep trying, not sure) – puddleglum Apr 18 '18 at 14:55
  • 1
    Just giving me thumbs up on this method. I screwed around in the API console for about an hour before trying this and it worked in a matter of seconds. Google needs to get their s**t together. – Chris Jun 18 '18 at 04:38
  • @JasonS This bug is still around as on 2022. I had to go to key & make some dummy changes & update it again to make it work with newly added API. – Dhrumil Bhankhar Feb 04 '22 at 05:02
18

Have you tried following the advice on the linked help page? The help page at http://g.co/mapsJSApiErrors says:

ApiNotActivatedMapError

The Google Maps JavaScript API is not activated on your API project. You may need to enable the Google Maps JavaScript API under APIs in the Google Developers Console.

See Obtaining an API key.

So check that the key you are using has Google Maps JavaScript API enabled.

spiv
  • 2,458
  • 1
  • 16
  • 20
  • 2
    But I dont need Google Maps Javascript API, just need Places API! Not using any maps, just autocomplete field. If Places API required another to be enabled, shouldnt that come with it automatically? – trainoasis Aug 06 '19 at 08:35
7

I had the same error. To fix the error:

  1. Open the console menu Gallery Menu and select API Manager.
  2. On the left, click Credentials and then click New Credentials.
  3. Click Create Credentials.
  4. Click API KEY.
  5. Click Navigator Key (there are more options; It depends on when consumed).

You must use this new API Navigator Key, generated by the system.

Peter David Carter
  • 2,548
  • 8
  • 25
  • 44
TigerSpirt
  • 161
  • 1
  • 12
0

Use Google Maps API https://developers.google.com/maps/gmp-get-started#enable-api-sdk to use the places library,click on Create Credentials tab on Google Cloud Console, and create the api key for the Maps JavaScript API. Sample Code below:

    <input type="text" id="txtFullAddress" />

    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=<Your-API-Key>&libraries=places"></script>
    <script type="text/javascript">  
        google.maps.event.addDomListener(window, 'load', function () {
            var inputAddressField = document.getElementById("txtFullAddress");
            var places = new google.maps.places.Autocomplete(inputAddressField);
            google.maps.event.addListener(places, 'place_changed', function () {
                var place = places.getPlace();
                var address = place.formatted_address;
                var latitude = place.geometry.location.lat();
                var longitude = place.geometry.location.lng();
                var mesg = "Address: " + address;
                mesg += "\nLatitude: " + latitude;
                mesg += "\nLongitude: " + longitude;
                alert(mesg);
            });
        });
    </script>
vikas dabade
  • 1
  • 1
  • 1