我正在使用印度地图,根据定义的纬度和经度在地图上显示一个标记,但是现在我必须在地图上显示多个标记,对此我一无所知,请帮帮我。 。
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://apis.mapmyindia.com/v2.0/mapApi /licKey=4d29cecd1c6f9f97247b82e18b637093&platform=aspx"></script>
<title>MapmyIndia Maps</title>
</head>
<body style="font-family:Verdana,Arial,sans-serif; font-size:12px; line-height:1.2em;">
<div id="MapDiv" style="width: 500px; height: 300px;">
</div>
<script type="text/javascript">
var _X = '76.652826';
var _Y = '10.78716';
var pt = new Point(_X, _Y);
$().ready(function () {
var map = $("#MapDiv");
map.MireoMap();
map.MireoMap("addMarker", HTMLHelper.mapMarker("https://d2t1xqejof9utc.cloudfront.net/screenshots/pics/81591c98d66921ed45c6fbab36601942/medium.png", 100, 100), pt);
})
</script>
</body>
</html>
该代码用于单幅地图绘制。我想在地图上显示多个标记。我为您提供一些网址供参考
http://www.mapmyindia.com/api/
http://maps.mapmyindia.com/
最佳答案
<!DOCTYPE html>
<html>
<head>
<title>Mapmyindia Maps</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<script src="https://apis.mapmyindia.com/advancedmaps/v1/<Lic_Key>/map_load?v1.1"></script>
<style>
html, body, #map { margin: 0; padding: 0;width: 100%;height: 100%;}
</style>
</head>
<body>
<div id="map"></div>
<script>
/*map initialized*/
var map=new MapmyIndia.Map("map",{ center:[28.61, 77.23], zoomControl: true, hybrid:true, search:true, location:true});
/*Latitude,Longitude set*/
var LatLng = [
["marker1",28.624076, 77.209860],
["marker2",28.607198, 77.196299],
["marker3",28.619706, 77.197501],
["marker4",28.618049, 77.223422],
["marker5",28.627391, 77.222907],
["marker6",28.632966, 77.206599],
["marker7",28.615035, 77.227370]
];
/*iterate on size of latitiude longitude set*/
for (var i = 0; i < LatLng.length; i++) {
new L.marker([LatLng[i][1],LatLng[i][2]])
.bindPopup(LatLng[i][0])
.addTo(map);
}
</script>
</body>
</html>