JavaScript GoogleMap 경로연결, 함수내 foreach 예제
<script type="text/javascript">
$(document).ready(
function() {
var latlng = ${routeEnd.beacon_gps};
var myOptions = {
zoom : 17,
center : latlng,
mapTypeId : google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document
.getElementById("map"), myOptions);
<c:forEach var="rl" items="${routelist }">
var latlngRoute = ${rl.beacon_gps};
var marker = new google.maps.Marker({
position : latlngRoute,
map : map,
title : '${rl.location_outTime}'
});
</c:forEach>
var flightPlanCoordinates = [
<c:forEach var="rl3" items="${routelist }">
${rl3.beacon_gps },
</c:forEach>
];
var flightPath = new google.maps.Polyline({
path: flightPlanCoordinates,
geodesic: true,
strokeColor: '#FF0000',
strokeOpacity: 1.0,
strokeWeight: 2
});
flightPath.setMap(map);
});
</script>