相关疑难解决方法(0)

Google Maps v3 api for localhost无法正常工作

我想尝试一个实现Gmaps v3的示例演示,并从Google的文档中尝试了这个示例,但没有输出,页面只加载几秒钟然后空白,没有输出.

<!DOCTYPE html>
<html lang = "en">
<head>
    <style type="text/css">
        html{height: 100%}
        body{height: 100%; margin: 0; padding: 0}
        #map-canvas{height: 100%}
    </style>
    <title>GMaps Demo</title>
    <script src = "https://maps.googleapis.com/maps/api/js?
                   key=${API_KEY}&sensor=false">
    </script>
    <script>
        function initialize(){
            var mapOptions = {
                center: new google.maps.LatLng(-34.397, 150.644),
                zoom: 8,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            var map = google.maps.Map(
                      document.getElementById("map-canvas"),
                      mapOptions);
        }

        google.maps.event.addDomListener(window, 'load', initialize);
        </script>
</head>
<body>
    <div id = "map-canvas">
    </div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

javascript google-maps google-maps-api-3

42
推荐指数
2
解决办法
7万
查看次数

与此API一起使用时,API密钥浏览器API密钥不具有引用限制

我正在尝试编程地理编码.我创建了API密钥,但是当我将它添加到我的网站代码中时,我没有得到任何东西,但是当我不使用API​​时,一切都运行良好.当我发送时:

https://maps.googleapis.com/maps/api/geocode/json?address=".$adres."&key=KLUCZ_XXX
Run Code Online (Sandbox Code Playgroud)

我收到回复:

Browser API keys cannot have referer restrictions when used with this API.
Run Code Online (Sandbox Code Playgroud)

如果我使用:

https://maps.googleapis.com/maps/api/geocode/json?address=".$adres" 
Run Code Online (Sandbox Code Playgroud)

结果是正确的,但每天查询的数量是有限的.

关键约束:引用HTTP(Web) - 设置为召唤查询的域.界面Google Maps Geocoding API已启用.

API密钥是否也必须在其他地方激活才能工作?

api maps geocoding

38
推荐指数
2
解决办法
4万
查看次数

如何在localhost上使用谷歌地图简单的api

我已经在我的网站上请求了一个用于嵌入谷歌地图的链接

https://developers.google.com/maps/documentation/embed/start
Run Code Online (Sandbox Code Playgroud)

并授权每个人都使用链接来使用它

Referers: Any referer allowed
https://code.google.com/apis/console/
Run Code Online (Sandbox Code Playgroud)

但我还是收到了

The Google Maps API server rejected your request. This API project is not authorized 
to use this API. Please ensure that this API is activated in the APIs Console: 
Learn more: https://code.google.com/apis/console
Run Code Online (Sandbox Code Playgroud)

是否有其他方法可以在本地使用嵌入式谷歌地图测试我的网站?

编辑:他们说:

Easy embedding

Google Maps Embed API maps are easy to add to your webpage—just set the URL 
you build as the value of an iframe's src attribute. Control the size of the 
map with the iframe's height …
Run Code Online (Sandbox Code Playgroud)

google-maps localhost

19
推荐指数
2
解决办法
5万
查看次数

Google Maps v3 API密钥不适用于本地测试

我有一个API密钥.它是"浏览器应用程序的关键(带有引用者).它工作正常,但当我尝试在我的本地开发服务器上使用它时,我没有被授权.我使用MAMP,我的本地URL如下所示:http://mysite.dev.

在"Referers"部分,我有:

mysite.com/*
mysite.dev/*
Run Code Online (Sandbox Code Playgroud)

制作一个(.com)工作正常,所以我很确定我的语法是正确的.但无论我尝试使用本地版本,我都会收到Google的授权错误信息,告诉我:

Google已禁止将Maps API用于此应用程序.提供的密钥不是有效的Google API密钥,也未授权此网站上的Google Maps Javascript API v3.如果您是此应用程序的所有者,则可以在此处了解如何获取有效密钥:https: //developers.google.com/maps/documentation/javascript/tutorial#api_key

肯定有办法让这个工作!它是什么?

javascript google-maps google-maps-api-3

11
推荐指数
1
解决办法
5万
查看次数

如何设置 Google API 密钥限制 - HTTP 引荐来源网址

Google API 密钥限制 - HTTP 引荐来源网址

我把我的 Azure 网站 url xxxx.scm.azurewebsites.net 放在那里,但不起作用(Google Places API Web 服务停止工作)。

localhost:44300 也不起作用。

我必须将密钥限制设置为“无”,然后 Google Places API Web 服务才能工作。

我做错了什么?

google-maps google-api google-places-api

4
推荐指数
1
解决办法
9185
查看次数