Hi,
I am confusing on this route map issue, which links should I have to use for my requirement.
Present, we have the code with Coordinate Points as below and the FULL CODE is also shown below. I need only one thing i.e., converting the string (1.e., Address or city name) to coordinate points (i.e., Ex. 50.1120423728813, 8.68340740740811). Please provide me that code.
waypoints.addCoordinate(
new nokia.maps.geo.Coordinate(50.1120423728813, 8.68340740740811));
waypoints.addCoordinate(
new nokia.maps.geo.Coordinate(50.140411376953125, 8.572110176086426));
FULL CODE
========
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>Route - Nokia Maps API Example</title> <script src="http://api.maps.nokia.com/2.1.1/jsl.js" type="text/javascript" charset="utf-8"></script> </head> <body> <div id="map" style="width:600px; height:400px;"></div> <script type="text/javascript"> var map = new nokia.maps.map.Display( document.getElementById("map"), { components: [new nokia.maps.map.component.Behavior()], zoomLevel: 11, center: [50.12, 8.62] } ); map.removeComponent(map.getComponentById("zoom.MouseWheel")); // Create a route controller var router = new nokia.maps.routing.Manager() // Create waypoints var waypoints = new nokia.maps.routing.WaypointParameterList(); waypoints.addCoordinate( new nokia.maps.geo.Coordinate(50.1120423728813, 8.68340740740811) ); waypoints.addCoordinate( new nokia.maps.geo.Coordinate(50.140411376953125, 8.572110176086426) ); var modes = [{ type: "shortest", transportModes: ["car"], options: "avoidTollroad", trafficMode: "default" }]; var onRouteCalculated = function (observedRouter, key, value) { if (value == "finished") { var routes = observedRouter.getRoutes(); // Create the default map representation of a route var mapRoute = new nokia.maps.routing.component.RouteResultSet(routes[0]).container; map.objects.add(mapRoute); // Zoom to the bounding box of the route map.zoomTo(mapRoute.getBoundingBox(), false, "default"); } else if (value == "failed") { alert("The routing request failed."); } }; // Add the observer function to the router's "state" property router.addObserver("state", onRouteCalculated); // Calculate the route (and call onRouteCalculated afterwards) router.calculateRoute(waypoints, modes); </script> </body> </html>

Reply With Quote

