Basic routing not working?
I've been trying to get routing to work with this new API and for some reason it just doesn't seem to get past even creating a manager.
The code is very basic so I can't really see what could go wrong.
[CODE]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Nokia Maps API Example</title>
<script src="http://api.maps.nokia.com/2.2.3/jsl.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div id="mapContainer" style="width:600px; height:400px;"></div>
<script type="text/javascript">
nokia.Settings.set("appId", "_peU-uCkp-j8ovkzFGNU");
nokia.Settings.set("authenticationToken", "gBoUkAMoxoqIWfxWA5DuMQ");
var map = new nokia.maps.map.Display(
document.getElementById("mapContainer"), {
'zoomLevel': 10,
'center': [52.51, 13.4]
}
);
try{
var router = new nokia.maps.routing.Manager();
}catch(e){alert(e);}
</script>
</body>
</html>
[/CODE]
The above code will give me the following error in Firefox 17
[CODE]TypeError: nokia.maps.routing.Manager is not a constructor[/CODE]
And in Internet Explorer 8
[CODE]TypeError: Object expected[/CODE]
The routing example found [URL="http://developer.here.net/apiexplorer/examples/api-for-js/routing/map-with-route-from-a-to-b.html"]here[/URL] only seems to produce a route in IE while FF gets a routing request failed, is routing bugged at the moment or did I miss something in my code?
What's going on?
Re: Basic routing not working?
Your problem lies with the following line:
[CODE]<script src="http://api.maps.nokia.com/2.2.3/jsl.js" type="text/javascript" charset="utf-8"></script>[/CODE]
The routing library is not loaded by default see: [url]http://developer.here.net/docs/maps_js/topics/overview.html#package-detection[/url]
You'll need to add [B]"all" [/B]or [B]"directions"[/B] at the end as shown:
[CODE]<!-- By default we add ?with=all to load every package available, it's better to change this parameter to your use case. Options ?with=maps|positioning|places|placesdata|directions|datarendering|all -->
<script type="text/javascript" charset="UTF-8" src="http://api.maps.nokia.com/2.2.3/jsl.js?with=all"></script>[/CODE]
This will load the routing module allowing you to create a routing manager.
Re: Basic routing not working?
Thanks, that got it working beautifully.