Results 1 to 5 of 5

Thread: App build with Google Maps

  1. #1
    Sencha Premium User couetbis's Avatar
    Join Date
    Jan 2008
    Location
    Nantes - France
    Posts
    108
    Vote Rating
    1
      0  

    Default App build with Google Maps

    Hi,
    I have an app that use Google map.
    When I run command sencha app build testing
    or production I have this error :
    [ERROR] ReferenceError: Can't find variable: google
    Stack trace: http://localhost:8087/app/view/Carto.js?_dc=1344325889171 : 1 : Anonymous

    File in question :
    Code:
    Ext.define('PBGeo.view.Carto', {
      extend : 'Ext.Panel',
      xtype : 'carto',
      requires : [ 'Ext.Map','Ext.SegmentedButton'],
      config : {
        layout : 'fit',   
        items : [ {
          xtype : 'toolbar',
          docked : 'top',
          scrollable:true,
          items : [ {
            xtype: 'segmentedbutton',
            allowMultiple: true,
            defaults: {
              iconMask: true
            },
            items:[{iconCls : 'cinema', id:'cinema'},
                   {iconCls : 'resto', id:'resto'},
                   {iconCls : 'favorites', id:'favoris'}]
          } ]
        }, {
          xtype : 'map',
          flex: 1,
          id: 'carte',
          useCurrentLocation : false,
          mapOptions : {
            center : new google.maps.LatLng(47.214292,-1.556175),
            streetViewControl : false,
            panControl : false,
            zoom : 15,
            zoomControl : true,
            zoomControlOptions : {
              position : google.maps.ControlPosition.LEFT_CENTER
            }
          }
        } ]
      }
    });
    Script tag for API Map is in index.html.
    How to resolve this ?

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Vote Rating
    1272
      0  

    Default

    This happens when your app files aren't downloaded and executed after the google maps JS file is downloaded and executed. This is because you are trying to create an instance as a property. Example:

    Code:
          mapOptions : {
            center : new google.maps.LatLng(47.214292,-1.556175)
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha Premium User couetbis's Avatar
    Join Date
    Jan 2008
    Location
    Nantes - France
    Posts
    108
    Vote Rating
    1
      0  

    Default

    Thanks for your reply but what is the solution ?

    I must center map on "maprender" event ?

  4. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Vote Rating
    1272
      0  

    Default

    Or use the applyMapOptions method in your own map subclass.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  5. #5
    Sencha Premium User couetbis's Avatar
    Join Date
    Jan 2008
    Location
    Nantes - France
    Posts
    108
    Vote Rating
    1
      0  

    Default

    Finally I have not succeeded to use applyMapOptions in a subclass so I choose to define map options in maprender events.

    Thanks for your help.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •