此页面无法正确加载Google Maps [英] This page can't load Google Maps properly
问题描述
我正在尝试从地图上获取经度和纬度,但出现此错误:
I'm trying to get the latitude and longitude from a map but I get this error:
此页面无法正确加载Google Maps.
This page can't load Google Maps properly.
我不确定是什么原因导致此错误. 我是否需要添加密钥,或者它只是我的代码中的错误?
I am not sure what causes this error. Do I need to add a key or it it just an error in my code?
感谢您的帮助.
我的代码
<script type="text/javascript">
$("#selectLocation").hide();
$(document).on("click",".setSelectLocation",function() {
$(".setSelectLocation").hide();
$("#selectLocation").show();
});
$("#area_id option").hide();
$("#area_id option[data-parent=" + $('#country').val() + "]").show();
$(document).on("change","#country",function() {
var value = $(this).val();
$("#area_id").show();
$("#area_id option").hide();
$('#area_id').prepend('<option disabled selected value="#">أختر المحافظه</option>');
$("#area_id option[data-parent=" + value + "]").show();
});
function initialize() {
var e = new google.maps.LatLng(24.701925,46.675415), t = {
zoom: 5,
center: e,
panControl: !0,
scrollwheel: 1,
scaleControl: !0,
overviewMapControl: !0,
overviewMapControlOptions: {opened: !0},
mapTypeId: google.maps.MapTypeId.terrain
};
map = new google.maps.Map(document.getElementById("latlongmap"), t)
geocoder = new google.maps.Geocoder
marker = new google.maps.Marker({
position: e,
map: map
})
map.streetViewControl = false
infowindow = new google.maps.InfoWindow({
content: "(24.701925,46.675415))"
})
google.maps.event.addListener(map, "click", function (e) {
marker.setPosition(e.latLng);
var t = e.latLng
o = "(" + t.lat().toFixed(6) + ", " + t.lng().toFixed(6) + ")";
infowindow.setContent(o),
document.getElementById("lat").value = t.lat().toFixed(6),
document.getElementById("lng").value = t.lng().toFixed(6)
})
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=KEY&language=ar&callback=initialize"></script>
推荐答案
对于在加载带有水印的Google地图时遇到此页面无法正确加载Google Maps" 错误的任何人一条仅用于开发目的" 消息:
For anyone who encounters the "This page can't load Google Maps properly" error when loading a Google map that is watermarked with a "for development purposes only" message:
有问题的错误是以下错误: https://developers .google.com/maps/faq#api-key-billing-errors
The error in question is this one: https://developers.google.com/maps/faq#api-key-billing-errors
要使用Google Maps Platform产品,必须计费 启用,并且所有请求都必须包含有效的API 键.
In order to use Google Maps Platform products, billing must be enabled on your account, and all requests must include a valid API key.
希望这会有所帮助.
这篇关于此页面无法正确加载Google Maps的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!