【发布时间】:2011-11-12 09:18:18
【问题描述】:
我正在我的网站中实现两种不同类型的谷歌地图。
-
第一个使用以下 MapTypeID 简单地显示带有标记的预定义位置:
mapTypeId:google.maps.MapTypeId.ROADMAP
第二个允许用户通过在地图上拖放标记等进行交互。
我这样调用我的 API:
<script src="http://maps.google.com/maps?file=api&v=2.x&sensor=false&key=ABQIAAAAfK8z5AsiUZwKZF5CkZMF6BTAb5FWVJrlydeWm3IWDEdBI1HaUhTpyn3_qR2q3IPbPnQKou9lkKVqIA" type="text/javascript"></script>
启动我的第一张地图时,我收到此错误:
Uncaught TypeError: Cannot read property 'ROADMAP' of undefined
如果我以这样的替代方式加载 Google Maps API:
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
第一张地图的错误消失了,但我现在在启动第二张地图时遇到了这个错误:
Uncaught ReferenceError: GOverlay is not defined
Uncaught ReferenceError: GControl is not defined
Uncaught ReferenceError: GControl is not defined
Uncaught ReferenceError: GCopyright is not defined
我认为这个问题与需要旧版本的谷歌地图 API 的地图有关。是否可以加载两个单独的谷歌地图 API?
谢谢
【问题讨论】:
标签: google-maps google-maps-api-3