简体   繁体   English

Google Maps API几何库无法加载

[英]Google Maps API Geometry Library failing to load

I want to use the Geometry Library from Google Maps API. 我想使用Google Maps API中的几何库。 The API was performing normally when just loading the Places Library but once I try include the Geometry Library it fails and returns: Uncaught TypeError: undefined is not a function %7Bmain,places%7D.js:55 仅加载位置库时,API正常运行,但是一旦我尝试包含几何库,它就会失败并返回: Uncaught TypeError: undefined is not a function %7Bmain,places%7D.js:55

Here is how I load the API using require.js: 这是我如何使用require.js加载API:

define([
    'async!//maps.googleapis.com/maps/api/js?key=MY_KEY&sensor=true&libraries=places,geometry'
], function(){

}

In the network tab the url request is: http://maps.gstatic.com/cat_js/intl/en_us/mapfiles/api-3/16/11/%7Bmain,geometry%7D.js which is returning 200 but that file is where the error is coming from. 在广告网络标签中,网址请求为: http://maps.gstatic.com/cat_js/intl/en_us/mapfiles/api-3/16/11/%7Bmain,geometry%7D.js : http://maps.gstatic.com/cat_js/intl/en_us/mapfiles/api-3/16/11/%7Bmain,geometry%7D.js ,返回200,但该文件是错误的来源。 Specifically on the line: k.google.maps.Load(a,b{......}) 专门在线: k.google.maps.Load(a,b{......})

If anyone has any insight why this issue please let me know. 如果有人对为什么这个问题有任何见解,请告诉我。

You need to change the order in which your bootstrap parameters are passed. 您需要更改引导程序参数的传递顺序。 ie instead of what you've done: 即而不是你所做的:

js?key=MY_KEY&sensor=true&libraries=places,geometry

You should pass the libraries before your key: 您应该在密钥之前通过库:

js?libraries=places,geometry&key=MY_KEY&sensor=true

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

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