Draw Specific Street On Google Maps
Draw Specific Street On Google Maps
by Mehmet Alp
HTML
<div id="harita" style="width:100%;"></div>
CSS
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
#harita { height: 100% }
JavaScript
var myOptions = {
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("harita"), myOptions);
var dirService = new google.maps.DirectionsService();
var dirRenderer = new google.maps.DirectionsRenderer({suppressMarkers: true});
dirRenderer.setMap(map);
var request = {
origin: "37.577875,36.945713",
destination: "37.577245,36.951292",
{location:"37.582482,36.927624"}],
travelMode: google.maps.TravelMode.DRIVING
};
dirService.route(request, function(result, status) {
if (status == google.maps.DirectionsStatus.OK) {
dirRenderer.setDirections(result);
}
});