我是谷歌地图的新手,我只是创建了我的第一张地图,以便将其合并到我的网站中.
我试图限制用户可以移动到英国的区域,并查看了这里的几个帖子,这些帖子都给出了非常相似的答案,但是我无法让代码为我工作.这个解决方案是我最接近的,但每当我尝试移动地图时,它都集中在我的一个边界点上,我无法将其移动到其他地方.
我可能犯了一个非常愚蠢的错误,在这种情况下我道歉,但是我无法弄清楚什么是错的.有没有人有任何想法?
谢谢
我的代码如下(取自Google的示例代码然后添加到) - 与边界相关的部分接近底部,从设置英国的边界开始:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<title>Google Maps</title>
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas { height: 100% }
</style>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=MYKEY&sensor=false">
</script>
<?
//code to get long and lat from http://www.webmonkey.com/2010/02/get_started_with_google_geocoding_via_http
$apikey = MYKEY;
$geourl = "http://maps.google.com/maps/geo?q=LS255AA&output=csv&key=$apikey";
// Create cUrl object to grab XML content using $geourl
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $geourl);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); …Run Code Online (Sandbox Code Playgroud)