如何在asp.net中获取地图上的数据库地址
how can i get the database address on the map in asp.net
对于相应的id,我希望标记指向该id的数据库地址。我该怎么做?我在哪里可以得到代码?我使用的是JS、Asp.Net、Sql服务器
这很简单,你必须创建一个数据库表,其中包括你地址的纬度和经度。。如果你需要一个简单的英文地址,那么你必须使用谷歌地理定位API,在存储地址后,然后对位置表中的每个条目执行以下操作In.cs
public StringBuilder locs = new StringBuilder(); //globalVariable
StringBuilder sb = new StringBuilder();
foreach (Location l in loc)
{
longitude = l.Yaxis; //where Yaxis is a variable in class Location to store longitude
lattudei = l.Xaxis; //where Xaxis is a variable in class Location to store Latitutde
sb.Append(string.Format(
"['{2}','{0}','{1}','../Img/Icons/Vehicles/icon_{2}.png'],",
lati, lon, imgurl);
}
locs.Append(sb.ToString());
.aspx
<script>
var map;
map = new google.maps.Map(document.getElementById('map'), {
zoom: 5,
minZoom: 4,
maxZoom: 8,
center: new google.maps.LatLng(30.03105543, -39.44091797),
});
var locations = [<%=locs %> ];
var markers=[];
for (i = 0; i < locations.length; i++) {
var marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map,
icon: new google.maps.MarkerImage(locations[i][3] + "?" + new Date().getTime(),
null, null, null, new google.maps.Size(40,15)),
id: locations[i][0],
});
markers.push(marker);
</script>
相关文章:
- 在谷歌地图上绘制位置数据库
- 使用ASP.NET将谷歌地图添加到项目中,并从数据库中检索位置
- 谷歌地图-数据库中的标记只显示最后一行的信息
- 如何在javascript谷歌地图中获取数据库值
- 如何在asp.net中获取地图上的数据库地址
- 我的地图数据's不会使用php存储在mysql数据库中
- 将本地MySQL数据库与PHP&谷歌地图上的JavaScript
- 从数据库中的城市创建谷歌地图标记
- 在javascript中从数据库下载坐标时,谷歌地图未显示
- 用sql数据库更新谷歌地图标记
- 如何从数据库中填充谷歌地图信息框
- 如何在谷歌地图上显示我的数据库地址,不带lat和long
- 如何离线使用谷歌地图,从mysql数据库映射位置
- 如果标记值已在数据库中生成,如何在地图中隐藏标记值
- 从数据库加载的位置的谷歌地图标记未显示
- 当谷歌地图标记点移动时,使用纬度和经度更新数据库
- 地址到谷歌地图上的数据库
- 从数据库获取所有纬度和长度以显示谷歌地图上的所有位置
- 当谷歌地图标记移动时更新mysql数据库
- 在谷歌地图上创建一个多边形,并使用MVC将结果保存到数据库中