简体   繁体   English

使用Mapstraction和Google Maps API-地图未显示

[英]Using Mapstraction and Google maps API - map not showing

I'm trying to upgrade a RoR app that uses mapstraction and google maps api, but I can't seem to get the map to show...I already posted a question with the code from that app here but haven't got an answer yet: 我正在尝试升级使用mapstraction和google maps api的RoR应用,但是我似乎无法显示地图...我已经在此处发布了该应用的代码问题,但还没有回答呢:

Upgrading google maps api with mapstraction in Rails 3 在Rails 3中使用Mapstraction升级Google Maps API

Because I still can't get that to work I created a test app and tried to get mapstraction working with the google maps api from scratch to see if I can replicate the issue and therefore fix it....but I still can't seem to get this to work. 由于我仍然无法正常工作,因此我创建了一个测试应用,并尝试从头开始使用Google Maps api进行mapstraction,以查看是否可以复制该问题并因此解决它。似乎可以使它正常工作。

In html of the test app I have: 在测试应用程序的html中,我有:

<DOCTYPE! HTML>
<html>
  <head>
    <script src="//maps.googleapis.com/maps/api/js?sensor=false" type="text/javascript"></script>
    <script src="http://mapstraction.com/mxn/build/latest/mxn.js?(googlev3)" type="text/javascript"></script>
    <style type="text/css">
    #map {
      height: 100px;
    }
    </style>
   </head>
   <body>
   <div id="map"></div>

   <script type="text/javascript">
    var map = new mxn.Mapstraction('map', 'googlev3');
    var latlon = new mxn.LatLonPoint(39.74,-104.98);
    map.setCenterAndZoom(latlon, 10);
   </script>
  </body>
</html>

This code is based on the tutorial for mapstraction that can be found here . 这段代码是基于mapstraction的教程,可以在这里找到。

The map is still not showing when I run this code, however it is showing "Map data Terms of Use" at the bottom of the div, as if the map is there... 当我运行此代码时,地图仍未显示,但是它在div底部显示了“地图数据使用条款”,就好像地图在那儿一样...

Any ideas on what I'm doing wrong here? 对我在这里做错的任何想法吗? I'm really stuck... :( 我真的被卡住了... :(

所以通过玩一些css,我发现地图没有显示出来,因为我将div显示样式设置为inline-block ...这仍然使我回到了原来的问题( 升级google在Rails 3中使用mapstraction的maps api,但至少我知道mapstraction和google maps正在工作:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM