在谷歌地图中获取特定区域 [英] getting particular area in google maps

查看:170
本文介绍了在谷歌地图中获取特定区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.......

我在地图上绘制了一个区域,并为数据库中保存的该区域取了个名字.现在,我将该名称添加到下拉列表中,当我单击该名称时,我想将该绘制的区域显示到地图中.plz帮助我..

hi.......

i have drawn some area in a map and giving some name to that area saved in data base.now iam getting that name into dropdownlist and i want to display that drawn area into map when click that name.plz help me..

推荐答案

从数据库中获取经度和纬度坐标以及缩放级别.将这些数据放入URL的相应​​位置.
Get the longutide and latitude coordinates from your database, and the zoom level. Place those data into their respective positions of the URL.


< title>

type ="text/javascript"& gt;



<title>

type="text/javascript"&gt;





var location = [["Bondi Beach",-33.890542,151.274856],["Coogee Beach",-33.923036,151.259052],["Cronulla Beach",-34.028249,151.157507],[''Manly海滩'',-33.800128,151.282085],[''马鲁布拉海滩'',-33.950198,151.259302]];
var map = new GMap2(document.getElementById(``map''));
var i; map.setCenter(new GLatLng(-33.92,151.25),10);
对于(i = 0; i& lt; locations.length; i ++)
{
var marker = new GMarker(new GLatLng(locations [i] [1],locations [i] [2]));
map.addOverlay(marker);
GEvent.addListener(marker,"click",function()
{
marker.openInfoWindowHtml("hi");
});
}





var locations = [[''Bondi Beach'', -33.890542, 151.274856], [''Coogee Beach'', -33.923036, 151.259052], [''Cronulla Beach'', -34.028249, 151.157507], [''Manly Beach'', -33.800128, 151.282085], [''Maroubra Beach'', -33.950198, 151.259302]];
var map = new GMap2(document.getElementById(''map''));
var i; map.setCenter(new GLatLng(-33.92, 151.25), 10);
for (i = 0; i &lt; locations.length; i++)
{
var marker = new GMarker(new GLatLng(locations[i][1], locations[i][2]));
map.addOverlay(marker);
GEvent.addListener(marker, "click", function ()
{
marker.openInfoWindowHtml("hi");
});
}




< html xmlns ="http://www.w3.org/1999/xhtml">
< head runat ="server">
< title></title>
< script src ="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAnfs7bKE82qgb3Zc2YyS-oBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSySz_REpPq-4WZA27Owgb
type ="text/javascript"></script>
</head>
< body>
< form id ="form1" runat ="server">
< div id ="map" style ="width:500px; height:400px;"></div>
< script type ="text/javascript">
var location = [["Bondi Beach",-33.890542,151.274856],["Coogee Beach",-33.923036,151.259052],["Cronulla Beach",-34.028249,151.157507],[''Manly海滩'',-33.800128,151.282085],[''马鲁布拉海滩'',-33.950198,151.259302]];
var map = new GMap2(document.getElementById(``map''));
var i; map.setCenter(new GLatLng(-33.92,151.25),10);
对于(i = 0; i< locations.length; i ++)
{
var marker = new GMarker(new GLatLng(locations [i] [1],locations [i] [2]));
map.addOverlay(marker);
GEvent.addListener(marker,"click",function()
{
marker.openInfoWindowHtml("hi");
});
}
</script>
</form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAnfs7bKE82qgb3Zc2YyS-oBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSySz_REpPq-4WZA27OwgbtyR3VcA&sensor=false"
type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server">
<div id="map" style="width: 500px; height: 400px;"></div>
<script type="text/javascript">
var locations = [[''Bondi Beach'', -33.890542, 151.274856], [''Coogee Beach'', -33.923036, 151.259052], [''Cronulla Beach'', -34.028249, 151.157507], [''Manly Beach'', -33.800128, 151.282085], [''Maroubra Beach'', -33.950198, 151.259302]];
var map = new GMap2(document.getElementById(''map''));
var i; map.setCenter(new GLatLng(-33.92, 151.25), 10);
for (i = 0; i < locations.length; i++)
{
var marker = new GMarker(new GLatLng(locations[i][1], locations[i][2]));
map.addOverlay(marker);
GEvent.addListener(marker, "click", function ()
{
marker.openInfoWindowHtml("hi");
});
}
</script>
</form>
</body>
</html>


这篇关于在谷歌地图中获取特定区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆