我正在尝试从地址获取地图,但出现以下错误
You have exceeded your request quota for this API 在我的控制台中,任何人都可以帮助我修复此问题。
我的Javascript代码如下所示,请检查并让我知道我是否做错了什么。。。
谢谢
<?php
$geocode = file_get_contents(\'http://maps.google.com/maps/api/geocode/json?address=\'.$address.\'&sensor=false\');
$output = json_decode($geocode); //Store values in variable
//print_r($output);
if($output->status == \'OK\'){ // Check if address is available or not
$latitude = $output->results[0]->geometry->location->lat; //Returns Latitude
$longitude = $output->results[0]->geometry->location->lng; // Returns Longitude
}
else {
echo "Sorry we can\'t find this location.Check the details again!";
}
?>
<script type="text/javascript">
jQuery(document).ready(function () {
// Define the latitude and longitude positions
var latitude = parseFloat("<?php echo $latitude; ?>"); // Latitude get from above variable
var longitude = parseFloat("<?php echo $longitude; ?>"); // Longitude from same
var latlngPos = new google.maps.LatLng(latitude, longitude);
// Set up options for the Google map
var myOptions = {
zoom: 14,
center: latlngPos,
mapTypeId: google.maps.MapTypeId.ROADMAP,
zoomControlOptions: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.LARGE
}
};
// Define the map
map = new google.maps.Map(document.getElementById("map"), myOptions);
// Add the marker
var marker = new google.maps.Marker({
position: latlngPos,
map: map,
title: "Your Location"
});
});
</script>