Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
77 lines (62 sloc) 2.68 KB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Directions</title>
<style>html,body{height:100%;}body{padding:0;margin:0;}h1{padding:0;margin:0;font-size:50%;}div{float:left;}</style>
</head>
<body>
<!-- MAP[START] -->
<div id="myMap" style='width:60%;height:70%;float:left;'></div>
<!-- MAP[END] -->
<!--Directions[START]-->
<div>
From:<input type="text" id="from" value="Siattle">
To:<input id="to" value="Redmond">
<select id="mode">
<option value="walking">walking</option>
<option value="driving">driving</option>
</select>
<input type="button" id="search" value="Search">
</div>
<div id="direction"></div>
<!-- Directions[END] -->
<script src='https://www.bing.com/api/maps/mapcontrol?callback=GetMap&key=[ *** YOUR MY KEY *** ]&setLang=en&setMkt=en-US' async defer></script>
<script src="../js/BmapQuery.js"></script>
<script>
//****************************************************************************************
// BingMaps&BmapQuery
//****************************************************************************************
//Init
function GetMap(){
//------------------------------------------------------------------------
//1. Instance
//------------------------------------------------------------------------
const map = new Bmap("#myMap");
//------------------------------------------------------------------------
//2. Display Map
// startMap(lat, lon, "MapType", Zoom[1~20]);
// MapType:[load, aerial,canvasDark,canvasLight,birdseye,grayscale,streetside]
//--------------------------------------------------
map.startMap(47.6149, -122.1941, "load", 10);
//------------------------------------------------------------------------
//3. Directions
// map.direction("#rootView", "from" , "to", waypoint[array]);
// !! For confirmation, set the parameters for each country !!
// + [ English => https://www.bing.com/...&setLang=en&setMkt=en-US ]
// + [ Japan => https://www.bing.com/...&setLang=ja&setMkt=ja-JP ]
//------------------------------------------------------------------------
document.getElementById("search").onclick = function () {
//Get From,To
const from = document.getElementById("from").value; //StartPoint
const to = document.getElementById("to").value; //EndPoint
const mode = document.getElementById("mode").value; //RouteMode[walking,driving]
const array = ["Bellevue", "Yarrow Point"]; //Waypoints...
map.direction("#direction", mode, from, to, array); //Direction Methed
//No Waypoint.
//map.direction("#direction", from , to, []);
};
}
</script>
</body>
</html>