×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Apr 2012
    Posts
    5

    nokia.maps.routing.WaypointParameterList is not a function

    Hi,
    I am workin me into the api.

    following problem:

    Code:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    
    <script type="text/javascript" charset="UTF-8" src="http://api.maps.nokia.com/2.2.0/jsl.js?with=all"></script>
    <script type="text/javascript" charset="UTF-8" src="jquery.js"></script>
    <title>lala</title>
    </head>
    	<body>
    	<script type="text/javascript">
    	/*	Set authentication token and appid 
    	*	WARNING: this is a demo-only key
    	*	please register on http://api.developer.nokia.com/ 
    	*	and obtain your own developer's API key 
    	*/
    	nokia.Settings.set( "appId", "_peU-uCkp-j8ovkzFGNU"); 
    	nokia.Settings.set( "authenticationToken", "gBoUkAMoxoqIWfxWA5DuMQ");
    
    	var router = new nokia.maps.routing.Manager(); // create a route manager;
    		
    	// The function onRouteCalculated  will be called when a route was calculated
    	var onRouteCalculated = function (observedRouter, key, value) {
    			if (value == "finished") {
    				var routes = observedRouter.getRoutes();
    				alert('OK');
    			} else if (value == "failed") {
    				alert("The routing request failed.");
    			}
    		};
    		
    	/* We create on observer on router's "state" property so the above created
    	 * onRouteCalculated we be called once the route is calculated
    	 */
    	router.addObserver("state", onRouteCalculated);
    
    	// Create waypoints
    	var waypoints = new nokia.maps.routing.WaypointParameterList();
    	waypoints.addCoordinate(new nokia.maps.geo.Coordinate(52.51652540955727, 13.380154923889933));
    	waypoints.addCoordinate(new nokia.maps.geo.Coordinate(52.52114106145058, 13.40921934080231));
    
    	/* Properties such as type, transportModes, options, trafficMode can be
    	 * specified as second parameter in performing the routing request.
    	 * 
    	 * See for the mode options the "nokia.maps.routing.Mode" section in the developer's guide
    	 */
    	var modes = [{
    		type: "shortest", 
    		transportModes: ["car"],
    		options: "avoidTollroad",
    		trafficMode: "default"
    	}];
    
    	// Calculate the route (and call onRouteCalculated afterwards)
    	router.calculateRoute(waypoints, modes);
    	</script>
    </body>
    </html>
    Throws "nokia.maps.routing.WaypointParameterList is not a function" exception....

    Whats my fault ?

  2. #2
    Regular Contributor
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    288

    Re: nokia.maps.routing.WaypointParameterList is not a function

    I've tried your code in a variety of browsers (Google Chrome 18, Safari 5.1.2, IE 8.0, FF 11.0) and it seems to work for me. The only thing that is potentially missing is a quirks mode meta statement:

    Code:
    <meta http-equiv="X-UA-Compatible" content="IE=7; IE=EmulateIE9" />
    What browser are you using? I'm guessing you may have a JavaScript problem with an obsolete browser somehow.

    The only suggestion I have is to look at the following pair of examples (which basically duplicate your use case) to see how it has been done elsewhere:
    http://api.maps.nokia.com/en/playgro...s/routing.html
    http://www.developer.nokia.com/Commu...een_two_points

    Do they work for you?

  3. #3
    Regular Contributor
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    288

    Re: nokia.maps.routing.WaypointParameterList is not a function

    Just for further information, you will get a "nokia.maps.routing.WaypointParameterList is not a constructor" message if you attempt to use routing without having loaded the routing library of the API. The cause of this is a missing parameter when loading the API:

    i.e.
    Code:
    <script type="text/javascript" charset="UTF-8" src="http://api.maps.nokia.com/2.2.0/jsl.js"></script>
    Should be:

    Code:
    <script type="text/javascript" charset="UTF-8" src="http://api.maps.nokia.com/2.2.0/jsl.js?routing=auto"></script>

Similar Threads

  1. evaluateJavaScript function can be used for loading maps in qt widgets?
    By Anisha Kaul in forum [Archived] Beginning Qt
    Replies: 14
    Last Post: 2011-05-27, 10:07
  2. Is there a way to convert Maps Data from Nokia Maps 3 to be compatible with N Maps 2
    By dimchopicha in forum General Development Questions
    Replies: 6
    Last Post: 2011-01-09, 17:50
  3. Launch OVI Maps Routing
    By gurmukh in forum Symbian
    Replies: 10
    Last Post: 2010-07-30, 14:43
  4. Navigation route coordinates from Nokia Maps or Ovi Maps
    By selimsolmaz in forum Mobile Java Tools & SDKs
    Replies: 2
    Last Post: 2010-03-04, 10:02
  5. Replies: 3
    Last Post: 2010-03-03, 10:25

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×