地图仅显示设备上的世界位置

时间:2014-09-29 22:38:35

标签: android google-maps ibm-mobilefirst

我正在使用IBM Worklight和以下库开发Android环境应用程序:http://storelocator.googlecode.com/git/index.html

每当我从文本框输入任何位置时,我都会看到世界地图,而不是我输入的位置。我需要放大才能看到确切的位置。它在Worklight Console上正常工作。但是在设备上,每当我输入任何城市名称时,我只会获得世界地图。 LogCat没有任何错误。

另外,我连续收到两个警报。

  1. “超出限额”
  2. “SQL查询格式错误。(这些网址参数可能有问题:select,Where,orderBy,intersects)。”
  3. 以下是HTML代码:

     <!DOCTYPE HTML>
      <html>
        <head>
            <meta charset="UTF-8">
            <title>testeApp</title>
            <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, 
             minimum-scale=1.0, user-scalable=0">
            <!--  
                <link rel="shortcut icon" href="images/favicon.png">
                <link rel="apple-touch-icon" href="images/apple-touch-icon.png"> 
            -->
            <link href="jqueryMobile/jquery.mobile-1.4.3.css" rel="stylesheet">
            <link href="jqueryMobile/jquery.mobile.inline-png-1.4.3.css" rel="stylesheet">
            <link href="jqueryMobile/jquery.mobile.inline-svg-1.4.3.css" rel="stylesheet">
            <link href="jqueryMobile/jquery.mobile.structure-1.4.3.css" rel="stylesheet">
            <link href="jqueryMobile/jquery.mobile.theme-1.4.3.css" rel="stylesheet">
            <link href="jqueryMobile/jquery.mobile.external-png-1.4.3.css" rel="stylesheet">
            <link rel="stylesheet" href="css/main.css">
            <link rel="stylesheet" href="jqueryMobile/jquery.mobile.icons-1.4.3.css">
            <script>window.$ = window.jQuery = WLJQ;</script>
            <script src="jqueryMobile/jquery.mobile-1.4.3.js"></script>
    
            <script type="text/javascript" charset="utf-8"
              src="http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places"></script>
    
            <script type="text/javascript" src="js/gme.js"></script>
            <script type="text/javascript" charset="utf-8" src="js/store-locator.min.js"></script>
            <link rel="stylesheet" href="css/storelocator.css">
            <script src="js/medicare-static-ds.js" type="text/javascript"></script>
    
    
             <style type="text/css">
              body { font-family: sans-serif; }
              #map-canvas, #panel { height: 500px; }
              #panel { width: 300px; float: left; margin-right: 10px; }
               p.attribution, p.attribution a { color: #666; }
             </style>
    </head>
    
      <body>
            <div data-role="page" >
                <div data-role="content">
                   <div id="panel" class="storelocator-panel" style="width : 100% ; height : 30%; " >   
    
                <form class="storelocator-filter" >
    
                <div class="location-search" id="locationSearch" style="height :35%; ">
    
                </div>
    
                <div class="feature-filter">
                </div>
                </form>
                </div>
                <div id="map-canvas" >
                </div>      
    
        </div>
        </div>
        </body>         
    

    以下是地图的javascript代码。

       google.maps.event.addDomListener(window, 'load', function() {
         var map = new google.maps.Map(document.getElementById('map-canvas'), {
           center: new google.maps.LatLng(43.67023, -79.38676),
            zoom: 4,
           mapTypeId: google.maps.MapTypeId.ROADMAP
        });
    
      var panelDiv = document.getElementById('panel');
    
      var data = new storeLocator.GMEDataFeed({
      tableId: '12421761926155747447-06672618218968397709',
      apiKey: 'AIzaSyAtunhRg0VTElV-P7n4Agpm9tYlABQDCAM',
      propertiesModifier: function(props) {
      var shop = ([props.NAME]);
      var locality = join([props.CITY, props.POSTAL_CODE], ', ');
    
      return {
        id: props.STORE,
        title: props.NAME,
        address: join([shop, props.ADDRESS, locality], '<br>'),
    
         };
      }
      });
    
       var view = new storeLocator.View(map, data, {
          geolocation: false
    
        });
    
            new storeLocator.Panel(panelDiv, {
          view: view
          });
         });
    
    
         function join(arr, sep) {
          var parts = [];
             for (var i = 0, ii = arr.length; i < ii; i++) {
                arr[i] && parts.push(arr[i]);
                }
              return parts.join(sep);
          }
    

1 个答案:

答案 0 :(得分:0)

对于缩放问题,要进行街道级缩放,我使用zoom: 18

至于超过&#34;速率限制&#34;警告,此警告由Google地图发出,您需要验证自己对Google地图的使用情况:https://developers.google.com/maps/documentation/business/articles/usage_limits