Arama butonu
Bu konudaki kullanıcılar: 1 misafir, 1 mobil kullanıcı
0
Cevap
1337
Tıklama
0
Öne Çıkarma
Googlemaps Yardım
Y
17 yıl (183 mesaj)
Teğmen
Konu Sahibi

Google map ile rota çizdirme konusunda bazı çalışmalarım var. Su anda iki belirli nokta arasında(amerikadaki şehirler,buyuk bilindik yerler) harita uzerinde yollarda rota çizebiliyorum. fakat benim yapmak istedigim A noktasına B ve C noktalarından ayrı ayrı rota çizdirmek. Umarım anlatabilmisimdir
mesela Los Angeles'e Anaheim ve Long Beach dan rotayı aynı anda çizdirmek istiyorum... Kodum assagıda inceleyebilirsiniz eger yardım edebilirseniz cok sevinirim.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>hsyn</title>
<script src="http://maps.google.com/?file=api&v=2.x&key=ABQIAAAAo7YKMCCRjMcdXgN-_5XO5xQ1A1fWz4alCCvd10yS0mOrn4_ChRRC3H3nZacpj5GPPLMaQ2nOdepGaA"
type="text/javascript"></script>

<style type="text/css">
body {
font-family: Verdana, Arial, sans serif;
font-size: 11px;
margin: 2px;
}
table.directions th {
background-color:#EEEEEE;
}

img {
color: #000000;
}
</style>
<script type="text/javascript">

var map;
var gdir;
var geocoder = null;
var addressMarker;

//Mouse in out (Shows controls when mouse is on map, Hides when out of map.)
GMap2.prototype.hoverControls = function(opt_noCloseIw){
var theMap = this;
theMap.hideControls();
GEvent.addListener(theMap, "mouseover", function(){
theMap.showControls();
});
GEvent.addListener(theMap, "mouseout", function(){
theMap.hideControls();
});

}
GMap.prototype.hoverControls = GMap2.prototype.hoverControls;

function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
gdir = new GDirections(map, document.getElementById("directions"));
GEvent.addListener(gdir, "load", onGDirectionsLoad);
GEvent.addListener(gdir, "error", handleErrors);
//map controls Zoom
map.addControl(new GLargeMapControl());
//sets center to given location
map.setCenter(new GLatLng(33.9068,-118.1909), 10);
//Adds controls to select Map Type
map.addControl(new GMapTypeControl());
map.hoverControls();
//Coordinates
GEvent.addListener(map, "mousemove", function(point){document.getElementById("mouse").value=point.toUrlValue();});
}
}
//route
function setDirections(fromAddress, toAddress, locale) {
gdir.load("from: " + fromAddress + " to: " + toAddress,
{ "locale": locale });
}

function handleErrors(){
if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);
else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code);

else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);



else if (gdir.getStatus().code == G_GEO_BAD_KEY)
alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);

else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);

else alert("An unknown error occurred.");

}

function onGDirectionsLoad(){
}



</script>


</head>
<body onload="initialize()" onunload="GUnload()">

<h2>DESIGN PROJECT I </h2>
<form action="#" onsubmit="setDirections(this.from.value, this.to.value, this.locale.value); return false">

<table>

<tr><th width="71" align="right">From: </th>

<td width="150"><input type="text" size="25" id="fromAddress" name="from"
value=" "/></td>
<th width="32" align="right">  To: </th>
<td width="150" align="right"><input type="text" size="25" id="toAddress" name="to"
value=" " /></td></tr>

<tr><th>Language: </th>
<td colspan="3"><select id="locale" name="locale">

<option value="en" selected>English</option>

<option value="tr">Turkish</option>
</select>

<input name="submit" type="submit" value="Route" />
<input name="text" type="text" id="mouse" style="width:10;" /></td>
</tr>
</table>


</form>

<br/>
<table class="directions">
<tr>
<th>Directions</th>
<th>Map</th></tr>

<tr>
<td valign="top"><div id="directions" style="width: 275px"></div></td>
<td valign="top"><div id="map_canvas" style="width: 600px; height: 400px"></div></td>

</tr>
</table>
</body>
</html>



DH Mobil uygulaması ile devam edin. Mobil tarayıcınız ile mümkün olanların yanı sıra, birçok yeni ve faydalı özelliğe erişin. Gizle ve güncelleme çıkana kadar tekrar gösterme.