Error on BpTspSolver

1,234 views
Skip to first unread message

Nacho Ordorica

unread,
Mar 12, 2012, 1:26:16 PM3/12/12
to Google Maps TSP Solver

I have used the example code and the .js source code. In the execution
the firebug throw me this error:

onProgressCallback is not a function
[Stop this error] onProgressCallback(tsp);
BpTspSolver.js (línea 516)


Any solution? I see the onProgressCallback in the tsp.js correctly..

Can anyone post a simple example for the use of BpTspSolver.js or a
link? Thanks.

Chi

unread,
Mar 12, 2012, 3:44:32 PM3/12/12
to Google Maps TSP Solver
I'm using an older version. I don't know about onProgressCallback.
It's maybe a progress bar between then addOneMoreAddress? Here is a
code on how I create a tsp object:

tsp = new BpTspSolver ( gmap2, directionsPanel, travelMode,
reasons ); // Create the tsp object
tsp.startOver();
for ( i=0;i<address.length;i++) {
tsp.addAddress ( address, addOneMoreAddress );
}
tsp.solveFinal ( tsp.getWaypoints (), callback );


function callback () {
gebDirections = tsp.getGDirections();
Polyline = gebDirections.getPolyline();
Duration = gebDirections.getDuration().seconds;
Distance = gebDirections.getDistance().meters;

Nacho Ordorica

unread,
Mar 13, 2012, 4:28:45 AM3/13/12
to Google Maps TSP Solver
Can you paste/mail me the complete example please? I tried all the
versions, from r1 to r12 but i cant do it work..
Otherwise, a very simple example between two hardcoded positions,
based on the example? Thanks a lot.

Chi Hoang

unread,
Mar 14, 2012, 1:14:25 PM3/14/12
to google-maps...@googlegroups.com
No. I can't. I already gave you an complete example. But from the
error message you post it seems you forgot to create an object tsp. If
you can see it in the code but it's not found by the parser then you
forgot to initiatilize the tsp object. If you want more help you must
post your code first or show us a link of your progress.

2012/3/13, Nacho Ordorica <ignacio....@gmail.com>:


--
...::: Chi Hoang :::...
Webdesigner, Multimedia und Datenbank Programmierer
Festnetz: +49-221-9460023
Info: http://www.chihoang.de
E-Mail: info at chihoang.de
Skype: tetramatrix

moozg

unread,
May 19, 2012, 11:08:43 AM5/19/12
to google-maps...@googlegroups.com
In BpTspSolver.js line 67 there was
var onProgressCallback = null;
I've changed it to
var onProgressCallback = function(){};
 
And it works, but partially, because there were still other errors. Most of them was caused by getElementById(..) which couldn't find the specific id. So I added divs to my html site with the missing ids. Then still were some errors, so I commented a part of createTomTomLink() and the part connected with sortable elements.

I also changed marker icon to be black.png or blue.png , and the script is no more searching for black1.png, black2.png, black3.png ..etc

So here's the working example. (I suppose the file would be automatically deleted after 30days of inactivity.)
http://www.sendspace.com/file/7cquip

Jananga Hettiarachchi

unread,
May 15, 2015, 8:39:15 AM5/15/15
to google-maps...@googlegroups.com
Thanks god it is still there :) thank u bro :)
I would be very thankfull to u if u could post a tutorial of how to use those js files :)

Grzegorz Nowak

unread,
Jun 15, 2016, 11:44:41 PM6/15/16
to Google Maps TSP Solver
Mirror please :(
Reply all
Reply to author
Forward
0 new messages