jesusdomines / jquery-ui-map

Automatically exported from code.google.com/p/jquery-ui-map
0 stars 0 forks source link

Routes aren't showing up. #18

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a basic map with jQuery UI. Maps div is called "map_canvas"
2. Use code sample provided for displaying driving directions. 
3. Directions are found but never drawn

What is the expected output? What do you see instead?
I expect to see a route drawn from one point to another.

What version of the product are you using? On what operating system?
Latest build 162 I believe 

Please provide any additional information below.
Here i the code I'm using. 

$(function(){
  $('#map_canvas').gmap().bind('init', function(evt, map){
    $('#map_canvas').gmap('displayDirections', { 'origin': 'Los Angeles, USA', 'destination': 'New York, USA', 'travelMode': google.maps.DirectionsTravelMode.DRIVING }, { 'panel': document.getElementById('panel') }, function(result, status) {
      if ( status === 'OK' ) {
        alert('Results found!');
      }
    });  
  });
  $("#map_canvas").gmap({"center": new google.maps.LatLng(41.741534, -111.829834)});
});

This bug might be not right as well because i'm trying to draw the route on the 
map while "displayDirections" implies that you are just showing directions vs 
drawingRoute or something like that. 

Original issue reported on code.google.com by sterling...@gmail.com on 29 Aug 2011 at 4:58

GoogleCodeExporter commented 8 years ago
Not a bug. Most likely you forgot to add <div id="panel"></div>. If this isn't 
the case, pls attach an html which proves the issue.

Original comment by johansalllarsson on 29 Aug 2011 at 5:28

GoogleCodeExporter commented 8 years ago
Yup that was it. Is it possible to not have a directions panel? In my case I am 
just drawing route for a visual indicator. 

Original comment by sterling...@gmail.com on 29 Aug 2011 at 5:31

GoogleCodeExporter commented 8 years ago
You should be able to set panel to null, or the parameter to null/{}

$('#map_canvas').gmap('displayDirections', { ... }, null, function(result, 
status) {

});

Original comment by johansalllarsson on 29 Aug 2011 at 5:37

GoogleCodeExporter commented 8 years ago
I get 
b is null

when i set the panel to null. I tried to update the services code so it would 
check for null but it seemed like the panel and route gets generated in one 
call vs it being separated out. I'm still new at js so I might be wrong but atm 
it errors out. 

Original comment by sterling...@gmail.com on 29 Aug 2011 at 6:12

GoogleCodeExporter commented 8 years ago
Changed so that you should be able to go with null now: 
http://jquery-ui-map.googlecode.com/svn/trunk/ui/jquery.ui.map.services.js

Original comment by johansalllarsson on 29 Aug 2011 at 6:34

GoogleCodeExporter commented 8 years ago
I tested this and it works great. Thank you. 

On a side note, is it possible to have waypoints because I have multiple 
"stops" on the map I'm building so I need to display multiple routes on one 
map. 

Original comment by sterling...@gmail.com on 30 Aug 2011 at 10:41