473,385 Members | 1,593 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

When I Select Source & Destination Dynamically Path Getting Scatter Across The Map

windows_mss
When I Select Source & Destination Dynamically,
Path Getting Scatter Across The Map...


hi,

i can able to get the Correct Route and Path for the corresponding Source

and destination, like this,

map.GetRoute('Redmond, Washington, United States','seattle, Washington, United States',VEDistanceUnit.KiloMeter,VERouteType.Short est);

when i try to do the same dynamically, i fails here, i attached the code please

tell where i gone wrong


Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  <head>
  3.   <title>Driving Directions in Virtual Earth</title>
  4.   <style type="text/css" media="screen"> ul, li {margin:0;padding:0;}
  5.  ul.popMenu { position:absolute; margin: 0; padding: 0px; list-style: none; font-family: arial; font-size:10px; text-align: center; width: 100px; /* Width of Menu Items */ border: 1px solid #ccc; background:white; display:none; }
  6.  ul.popMenu li { position: relative; }
  7.  /* Styles for Menu Items */ ul.popMenu li a { display: block; text-decoration: none; color: black; padding: 1px 1px 0px 1px; }
  8.  ul.popMenu li a:hover { background:#335EA8; color:white; }
  9.  .msg {filter: alpha(opacity=80);opacity: .8;z-index: 3;width: 15em;height: 15em;border: solid 1px black;background: white; visibility: hidden;overflow: auto;font-family: Verdana;font-size: 75%;position: absolute;}
  10.  .cont { z-index: 3;width: 15em; height: 5em;border: solid 1px black; background: white; position: absolute;}
  11.  </style>
  12.  <script src="http://dev.virtualearth.net/mapcontrol/v4/mapcontrol.js"></script>
  13.   <script>
  14.     var map = null;
  15.     var pLat;
  16.   var pLon;
  17.   var stPoint = null;
  18.   var ePoint = null;
  19.  
  20.   //function OnPageLoad()
  21.   //{
  22.   //  map = new VEMap('myMap');
  23.   //  map.LoadMap(new VELatLong( 19.06,81.65), 4, 'r', false);
  24.   //  map.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers);
  25.   //  map.AttachEvent("oncontextmenu", SPopupMenu);
  26.   //}
  27.  
  28. //1.3.1115150037.31";
  29. //var map = null;
  30.          var le = 0;
  31.          function OnPageLoad()
  32.          {
  33.      var head = document.getElementsByTagName("head")[0];
  34.      var s = document.createElement('script');
  35.      s.id = 'VEScript';
  36.      s.type = 'text/javascript';
  37.      s.src = "http://maps.live.com/veapi.ashx?v=1.3.1204222815.33";
  38.      head.appendChild(s);
  39.      DelayGetMap();
  40.          }
  41.          function DelayGetMap()
  42.          {
  43.                 try {
  44.                         map = new VEMap('myMap');
  45.                         //document.getElementById("myLoading").style.display = "none";
  46.                         document.getElementById("myMap").style.display = "block";
  47.                         //map.LoadMap(new VELatLong(21.6, 85.33), 10 ,'h' ,false);
  48.                         map.LoadMap(new VELatLong( 19.06,81.65), 4, 'r', false);
  49.       map.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers);
  50.       map.AttachEvent("oncontextmenu", SPopupMenu);
  51.                 }catch(err)
  52.                 {
  53.                         if (le < 30)
  54.                         {
  55.                                 le++;
  56.                                 setTimeout("DelayGetMap()",51);
  57.                                 alert("Site is busy.");
  58.                                 GetMap();
  59.                         }
  60.                 }
  61.          }
  62.  
  63.   function SPopupMenu(e)
  64.   {
  65.     pLat = e.view.LatLong.Latitude;
  66.     pLon = e.view.LatLong.Longitude;
  67.     var latlong = map.LatLongToPixel(new VELatLong(pLat,pLon));
  68.  
  69.     var x = map.GetLeft();
  70.     var y = map.GetTop();
  71.  
  72.     var menu = document.getElementById('popupmenu');
  73.     menu.style.display='block'; //Showing the menu
  74.     menu.style.left = latlong.x + x; //Positioning the menu
  75.     menu.style.top = latlong.y + y;
  76.   }
  77.  
  78.   function rmPopupMenu()
  79.   {
  80.     var menu = document.getElementById('popupmenu').style.display='none';
  81.   }
  82.  
  83.   function SetStart()
  84.   {
  85.     try
  86.     {
  87.     map.DeletePushpin('start');
  88.     } catch(err) {}
  89.  
  90.     stPoint = new VELatLong(pLat, pLon);
  91.     var pin = new VEPushpin('start', stPoint, null, 'Start Here', 'Starting point');
  92.     map.AddPushpin(pin);
  93.  
  94.     rmPopupMenu();
  95.   }
  96.  
  97.   function SetEnd()
  98.   {
  99.     try
  100.     {
  101.     map.DeletePushpin('end');
  102.     } catch(err){}
  103.  
  104.     ePoint = new VELatLong(pLat, pLon);
  105.     var pin = new VEPushpin('end', ePoint, null, 'pin', 'end');
  106.     map.AddPushpin(pin);
  107.  
  108.     rmPopupMenu();
  109.   }
  110.  
  111.   function gDir()
  112.   {
  113.     map.GetRoute(stPoint, ePoint, VEDistanceUnit.Kilometers, null, GRoute);
  114.     rmPopupMenu();
  115.   }
  116.  
  117.  function GRoute(route)
  118.          {
  119.           var rtInfo ="Total distance:"+route.Itinerary.Distance+route.Itinerary.DistanceUnit;
  120.      document.getElementById("info").innerHTML = rtInfo;
  121.  
  122.          }
  123.   </script>
  124.  </head>
  125.  <body onload="OnPageLoad();" style="OVERFLOW:hidden">
  126.   <div id="info" style="Width:100px;Height:15px;Font-family:Arial;Font-size:12px;display:block;"></div>
  127.   <div id="myMap" style="WIDTH:800px;POSITION:relative;HEIGHT:650px">
  128.   </div>
  129.   <DIV>
  130.    <ul id="popupmenu" class="popMenu">
  131.     <li>
  132.      <a href="#" onclick='SetStart()'>Start</a>
  133.      <a href="#" onclick='SetEnd()'>End</a>
  134.      <a href="#" onclick='gDir()'>ShowRoute</a></li>
  135.    </ul>
  136.   </DIV>
  137.    <!-- <DIV id="Dt" style="WIDTH: 100px; HEIGHT: 10px"></DIV> -->
  138.  </body>
  139. </html>
  140.  
  141.  
Feb 8 '07 #1
4 1949
kenobewan
4,871 Expert 4TB
What error do you get? Try writing the values of stPoint & ePoint to check that they are valid...
Feb 9 '07 #2
my problem solved
Feb 27 '07 #3
kenobewan
4,871 Expert 4TB
How did you fix the problem?
Feb 27 '07 #4
I Missed This line in <head>

Expand|Select|Wrap|Line Numbers
  1. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Feb 28 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: Andrew | last post by:
Last night I was reading about implementing my own stack. The example given pushes items on and off the stack at the start and end of each procedure (ie. in a std module). What's not so clear is...
8
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
0
by: znelson | last post by:
I'm looking for a way to transform the contents of n source tables into a single destination table. This by itself is no problem. However, the name of the source tables change, so I'll need to...
0
by: Raj Chudasama | last post by:
how can i select all rows in a datagrid also how can add checkbox to each of my rows in datagrid. I tried to use DataGridColumnStyle but failed try {
3
by: Rik | last post by:
Hello, first of all, my provider sucks, newsserver is down for the #nth time now, offcourse when I have an urgent question.... So this will be me first time using Google Groups, forgive me if...
11
by: Nemisis | last post by:
Hi everyone, sorry if this post gets really long, i just wanna make sure i fully explain what i am trying to do. I am new to OOP and .net 2.0, so if this is obvious, i am sorry. I have wrote a...
6
by: Michael | last post by:
I need to copy a huge file (around 300Mb) from a mapped network drive to another. I have created a console application and used System.IO.File.Copy function. But I want to know the process of...
2
by: chike_oji | last post by:
Please can someone help me. I am writing a web application, that allows for the upload of an excel sheet into the database. I have an upload button and a save button. The upload button allows...
3
by: ibeehbk | last post by:
Hi. I have a form made in xhtml. I test via vbscript to make sure none of the fields are empty and properly formatted (ie email). All the regular fields work. However, I have two drop down menus...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.