<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Thank you, Chris. It appears in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/GoogleMaps-JavaScript-API-Problem/m-p/1111450#M72485</link>
    <description>Thank you, Chris. It appears that this code works now despite won't work before.
Yes, i have checked all the js inclusion in the head tag, all js included.

Thanks again.</description>
    <pubDate>Tue, 03 May 2016 05:59:51 GMT</pubDate>
    <dc:creator>Anas_F_</dc:creator>
    <dc:date>2016-05-03T05:59:51Z</dc:date>
    <item>
      <title>GoogleMaps JavaScript API Problem</title>
      <link>https://community.intel.com/t5/Software-Archive/GoogleMaps-JavaScript-API-Problem/m-p/1111448#M72483</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I want to ask why this code does not work:&lt;/P&gt;

&lt;PRE class="brush:jscript;"&gt;/*jshint browser:true */
/*global $, console, alert */
(function () {
    "use strict";
    /*
      hook up event handlers 
    */

    function register_event_handlers() {

        /* button  #revBtn */
        $(document).on("click", "#revBtn", function (evt) {
               var canvas = document.getElementById("map-div"),
                      m;

               var latlng = new google.maps.LatLng(51.4975941, -0.0803232);

               var options = {
                      center: latlng,
                      zoom: 11,
                      mapTypeId: google.maps.MapTypeId.ROADMAP
                };

                m = new google.maps.Map(m, options);
        });

    }
    document.addEventListener("app.Ready", register_event_handlers, false);
})();&lt;/PRE&gt;

&lt;P&gt;The above code is from my index_user_scripts.js&lt;/P&gt;

&lt;P&gt;This is what I got from JSHint log:&lt;/P&gt;

&lt;PRE class="brush:plain;"&gt;16	'google' is not defined. (W117)	var latlng = new google.maps.LatLng(51.4975941, -0.0803232);
21	'google' is not defined. (W117)	mapTypeId: google.maps.MapTypeId.ROADMAP
24	'google' is not defined. (W117)	m = new google.maps.Map(m, options);&lt;/PRE&gt;

&lt;P&gt;The map supposed to change to the given latitude and longitude values.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I am using Intel XDK version 3240, using Standard HTML5 Only by designer.&lt;/P&gt;

&lt;P&gt;Any idea how do I resolve this?&lt;/P&gt;</description>
      <pubDate>Sat, 30 Apr 2016 15:21:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/GoogleMaps-JavaScript-API-Problem/m-p/1111448#M72483</guid>
      <dc:creator>Anas_F_</dc:creator>
      <dc:date>2016-04-30T15:21:35Z</dc:date>
    </item>
    <item>
      <title>JSHint simply doesn't know</title>
      <link>https://community.intel.com/t5/Software-Archive/GoogleMaps-JavaScript-API-Problem/m-p/1111449#M72484</link>
      <description>&lt;P&gt;JSHint simply doesn't know about the 'google' namespace. That doesn't necessarily mean there is an actual error.&lt;/P&gt;

&lt;P&gt;Do you have the inclusion to the google maps API in your HTML? If using the App Designer google maps widget you should. &amp;nbsp;If you do, then you could add 'google' to the global listing in index_user_scripts.js to remove the JSHint warning.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I'm not sure your code is supposed to change the Lat/Lng. The map object should already be initialized in google_maps.js &amp;nbsp;on startup, and in the Properties of the Google Map you can set the initial center location and zoom.&lt;/P&gt;

&lt;P&gt;Your code is initializing a _new_ map object, which should not be needed. &amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Take a look at google_maps.js (which should be bound into your project). You'll see that window.googleMaps is an array of all the maps set up for your app. &amp;nbsp;So &amp;nbsp;googleMaps[0] should be your Google Map. To affect it, use the Google Maps API.&lt;/P&gt;

&lt;P&gt;For example:&lt;/P&gt;

&lt;PRE class="brush:jscript;"&gt;googleMaps[0].setCenter(new google.maps.LatLng(37.4419, -122.1419), 13);&lt;/PRE&gt;

&lt;P&gt;will change the center point of the map.&lt;/P&gt;

&lt;P&gt;For more information on the Google Maps API see&amp;nbsp;https://developers.google.com/maps/documentation/javascript/&lt;/P&gt;

&lt;P&gt;Hope this helps,&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2016 16:32:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/GoogleMaps-JavaScript-API-Problem/m-p/1111449#M72484</guid>
      <dc:creator>Chris_P_Intel</dc:creator>
      <dc:date>2016-05-02T16:32:31Z</dc:date>
    </item>
    <item>
      <title>Thank you, Chris. It appears</title>
      <link>https://community.intel.com/t5/Software-Archive/GoogleMaps-JavaScript-API-Problem/m-p/1111450#M72485</link>
      <description>Thank you, Chris. It appears that this code works now despite won't work before.
Yes, i have checked all the js inclusion in the head tag, all js included.

Thanks again.</description>
      <pubDate>Tue, 03 May 2016 05:59:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/GoogleMaps-JavaScript-API-Problem/m-p/1111450#M72485</guid>
      <dc:creator>Anas_F_</dc:creator>
      <dc:date>2016-05-03T05:59:51Z</dc:date>
    </item>
  </channel>
</rss>

