/ Published in: JavaScript
Expand |
Embed | Plain Text
//Google Güzergah Servisini atıyoruz var guzergahServisi = new google.maps.DirectionsService(); function StartMapping(HatXMLYol) { //guzergahServisi degiskeninden alinan veriyi //DirectionsRenderer ile isleyecegiz. guzergahGoster = new google.maps.DirectionsRenderer(); var HaritaOnline = document.getElementById('haritaon').checked; if(HaritaOnline == true){ var myLatlng = new google.maps.LatLng("istanbul"); var myOptions = { zoom: 4, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var georssLayer = new google.maps.KmlLayer('http://otobus.de/XML/'+ HatXMLYol +'hatDurak.xml'); georssLayer.setMap(map); //DirectionsRenderer ile isledigimiz (calcRoute fonksiyonunu cagirir). //verilere gore guzergahi haritada gosteriyoruz guzergahGoster.setMap(map); // } } //goruntulenecek guzergahin hesaplanmasi function calcRoute() { var buradan_basla = ""; //guzergah tarifinin baslayacagi koordinat var burada_bitir = ""; //guzergah tarifinin bitecegi koordinat var istek = { origin:buradan_basla, destination:burada_bitir, travelMode: google.maps.DirectionsTravelMode.DRIVING }; guzergahServisi.route(istek, function(yanit, durum) { if (durum == google.maps.DirectionsStatus.OK) { guzergahGoster.setDirections(yanit); } }); }
You need to login to post a comment.
