×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jun 2013
    Posts
    2

    how to create a route between two geo locations in html5 here maps

    I want to simply create a route between two points. I don't want user to use search option and create a route. I am getting start and end coordinates from server and I have to use them to display a route on the map.
    Following is how I initialize the maps

    Code:
    <script type="text/javascript">
    	function init_nokia_maps() {
    		nokia.mh5.assetsPath = "http://api.maps.nokia.com/mobile/1.0.2/lib/";
    		nokia.mh5.app.embed({
    			"domNode" : "#application_location",
    			"appId" : "demo_wwzrmoloHAFVvyW",
    			"appCode" : "Vgl_08RQWnjJo92Lw1F_uQ",
    			"configuration" : {
    				"map" : {
    					"positionButton" : true,
    					"schema" : "normal.day.transit",
    					"infobubble" : {
    						"content" : ["title", "description"]
    					}
    				},
    				"route": { "fromPlaceholder": "from", "toPlaceholder": "to" }
    
    			}
    		});
    	}
    init_nokia_maps();
    
    </script>
    Now I want to write a function that create a route. Please help me with code example.

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2012
    Posts
    65

    Re: how to create a route between two geo locations in html5 here maps

    If you just want to show a route and that's all using the whole default application is an overkill for your use case. Just use the map and draw a route on it:

    Code:
    <body>
        <div id="myMap" style="width: 500px; height: 500px;"></div>
        <script type="text/javascript" src="http://api.maps.nokia.com/mobile/1.0.2/lib/mh5.js"></script>
        <script type="text/javascript">
            (function setup() {
                
                nokia.mh5.assetsPath = "http://api.maps.nokia.com/mobile/1.0.2/lib/";
                nokia.mh5.appId = "demo_wwzrmoloHAFVvyW";
                nokia.mh5.appCode = "Vgl_08RQWnjJo92Lw1F_uQ";
               
                var map = new nokia.mh5.components.Map({
                    center: {
                        longitude: 0.5,
                        latitude: 51.32
                    },
                    zoom: 14,
                    listeners: {
                        ready: function() {
                            map.route = {
                                shape: [/*start*/{latitude: 51.3123, longitude: 0.4987}, /*end*/{latitude: 51.32673, longitude: 0.5087}],
                                color: "rgb(0, 255, 0)"
                            };
                        }
                    }
                });
                document.getElementById("myMap").appendChild(map.root);
            })();
        </script>
    </body>

    Leo
    Last edited by ZieL; 2013-06-16 at 16:18.

Similar Threads

  1. How to obtain a route between locations
    By m00zg in forum [Archived] MH5: Nokia Maps Framework for mobile HTML5
    Replies: 1
    Last Post: 2012-07-07, 10:22
  2. Welcome to the Maps API for mobile HTML5 discussion forum!
    By Nokia Ron in forum [Archived] MH5: Nokia Maps Framework for mobile HTML5
    Replies: 0
    Last Post: 2012-05-18, 18:17
  3. 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
  4. 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
  •  
×