Problems with the GetRoute method

Hi,

I've tried to use the VEMap.GetRoute method, but the run line from the start to the ending location doesn't appear, and the pushpin over the ending location doesn't bring a message...

This is my code...Is there someone who can help me

Thanks a lot...

<!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">

<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js"></script>
<script>
var map = null;
function GetMap(){
map = new VEMap('map');
map.LoadMap(new VELatLong(45.069285079074305, 7.688970565795898), 14 ,'r' ,false);
map.GetRoute(new VELatLong(45.07048984964724, 7.686738967895523), new VELatLong(45.06976244403705, 7.684078216552734));
}
</script>
</head>

<body onload="GetMap();">

<div id='map' style="position:relative; width:400px; height:400px;"></div>

</body>
</html>



Answer this question

Problems with the GetRoute method

  • Manoj Kumar Goud

    Thanks Caleb.
    I'll have to check out the streets and trips product to see how its been implimented.
    I'm guessing its not in my MSDN subscription
    John.


  • Greg Allen

    Gerry is right about the meta tag and the end address questions. I don't know enough about jsp, or your implementation of it, but seems clear that the jsp is stripping out the <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> line. You need that to render the route line, so you might want to dig deeper into what the jsp is doing there. Maybe there is a jsp expert on this forum who has come across this. It might even be worth starting a new thread specifically about jsp problems.

    As for the walking directions question, the short answer is "no". Right now, VE only provides driving directions.


  • Michael Collins

    Caleb,
    are there any plans to allow for custom routing For example if we knew where the toll roads or speed camera or traffic accidents are and wanted to avoid them We could simply ask for a route that doesn't go near an array of lat lons. Would be a nice feature
    John.


  • Michael Covington

    Hi,

    When I read your post I thought you were having similar problems to those I was having a coupla weeks ago, but just as a little test I copied your code and tested it, and......

    I can't see the problem!!

    The route line displays, the start and end points both display info bubbles on mouseover.

    Works in FF1.5, Opera 9, IE6 & IE7B3.

    Gerry


  • Janetjyothi

    I think it is more useful to a user to say "keep me off of I-5 and all roads smaller than 45 MPH" but it relies on VE knowing the correct speed limts and what the I5 is. For a custom solution it would be nice to use something more generic like a lat lon or polygon. That would allow developers more freedom to develop something special.

    I guess there are two issues.
    1) what is a useful simply function to plug into applications to add value to consumers
    2) what is a useful advanced function that developers can use to create custom applications

    Lets take developing routes for a crain vechile. It will have a highly specific set of roads it can travel on and this may vary by the time of day. VE is never going to do this but if there was a way for a developer to be able to do it through some generic functions...

    To me something really simple and generic like a set of avoidance lat lon pairs or polygons would be really useful.
    John.

  • R.Arjun

    I'll be honest, I know nothing about JSP but the line in the HTML that MUST there is:

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    Without the utf-8 the route line will NEVER display. As an example, mine was set to ISO-8859-1 before Caleb pointed it out.

    As for the end point not displaying the "Arrive at" address, I THINK this may have something to do with the fact that you (and I for that matter) are using Lat/Long coords so the directions don't exactly have an "address" as a start- and end-point.

    I'm going to have a little play around with this in a while and get back to you.

    Gerry


  • markovuksanovic

    Hi,

    It's funny!

    When the code is produced by a jsp page, the route line don't display, and the end point displays an info bubble "Arrive at" (no address)...

    If I copy the code produced by the jsp into an html page, the route line displays, but the problem with the end point remains...


  • &amp;#40643;&amp;#27859;&amp;#37327; Jeremy Wong

    Hi SoulSolutions:

    Can you tell me this problem have fixed. Because I have same problem.

    My Code:
    map.GetRoute( new VELatLong(43, -122), new VELatLong(43, -123.8) );

    Thank you.
    YU-TIEN

  • Nagu

    I can't really answer that, except to say: a) you're not the first person to request such a feature, and b) we're listening.

    Our CD products (Streets and Trips and MapPoint) allow you to specify multiple points along a route, and even click-and-drag the route from one road to another. I haven't seen anyone request an "avoidance zone" before (you specify an array of LatLongs that you want to route to avoid)--its an interesting idea. But most people seem to just want to specify a road (or road type) to avoid. For example, is it more useful to say "avoid this polygon" or "keep me off of I-5 and all roads smaller than 45 MPH"


  • Anand Raman - MSFT

    Turns out I was slightly wrong--our latest version of Streets and Trips (S&T07) apparently allows you to do exactly what you want--define an avoidnace area.

    So, anyway, I've passed the idea on to the team for consideration.


  • Edentheguy

    I've inserted <meta http-equiv="Content-Type" content="text/html; charset=utf-8">...

    ...nothing: the line disappears in the jsp page...

    ...for the end point...I'll try to use the address...

    Can I take advantage of you for another question The GetRoute method returns the driving directions...do you know if it's possible to get the walking directions

    Thanks a lot

    Marta


  • Problems with the GetRoute method