Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User ck14085's Avatar
    Join Date
    Sep 2012
    Posts
    2
    Does anyone know how I may be able to embed maps as a column in a list report, where the map shows the route between address A and address B? I have the route piece figured out, but I'm having trouble referencing the Cognos query in the search function of the API.

    Your help is much appreciated!

  2. #2
    Nokia Developer Moderator jasfox's Avatar
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    225
    Assuming you can access the route's geometry attribute, you are probably best off using the RESTful Maps API to embed a URL, just take every nth GeoCoordinate and append it after http://m.nok.it/route?r0=

    Code:
    http://m.nok.it/route?r0=37.392353,-8.379645,37.39834,-8.378095,37.405402,-8.377928,37.41029,-8.37408,37.416594,-8.371035,37.422696,-8.367634,37.428898,-8.367724,37.431318,-8.362196,37.43734,-8.360278,37.442454,-8.357572,37.445488,-8.358388,37.446134,-8.364259,37.448019,-8.36999,37.453324,-8.371828,37.456633,-8.376939,37.460018,-8.381011,37.463361,-8.386274,37.465715,-8.386334,37.465706,-8.37995,37.465758,-8.373981,37.466499,-8.367954,37.466104,-8.361575,37.470595,-8.360625,37.475236,-8.361252,37.479725,-8.361962,37.483909,-8.360845,37.484771,-8.354681,37.488434,-8.350574,37.486818,-8.346772,37.489562,-8.341675,37.494901,-8.341929,37.495555,-8.338603,37.495145,-8.332353,37.498235,-8.328822,37.498359,-8.322347,37.49964,-8.31579,37.503105,-8.310629,37.501201,-8.30543,37.497441,-8.308437,37.493229,-8.312452,37.490508,-8.318291,37.485718,-8.323031,37.483281,-8.325975,37.480969,-8.321812,37.477917,-8.317126&w=600&h=600&t=3&nord&m0=37.392353,-8.379645,37.477917,-8.317126&lc0=ff8dc72d&lw0=5
    The last bit defines a Width, height, Start and end markers, line colour and line width
    Code:
     w=600&h=600&t=3&nord&m0=37.392353,-8.379645,37.477917,-8.317126&lc0=ff8dc72d&lw0=5
    Then use this URL in an html <IMG> to embed a map into your report.
    Jason Fox
    Technical Support Engineer, Maps Platform
    Location & Commerce

    http://developer.here.net/

  3. #3
    Registered User ck14085's Avatar
    Join Date
    Sep 2012
    Posts
    2
    Quote Originally Posted by jasfox View Post
    Assuming you can access the route's geometry attribute, you are probably best off using the RESTful Maps API to embed a URL, just take every nth GeoCoordinate and append it after http://m.nok.it/route?r0=

    Code:
    http://m.nok.it/route?r0=37.392353,-8.379645,37.39834,-8.378095,37.405402,-8.377928,37.41029,-8.37408,37.416594,-8.371035,37.422696,-8.367634,37.428898,-8.367724,37.431318,-8.362196,37.43734,-8.360278,37.442454,-8.357572,37.445488,-8.358388,37.446134,-8.364259,37.448019,-8.36999,37.453324,-8.371828,37.456633,-8.376939,37.460018,-8.381011,37.463361,-8.386274,37.465715,-8.386334,37.465706,-8.37995,37.465758,-8.373981,37.466499,-8.367954,37.466104,-8.361575,37.470595,-8.360625,37.475236,-8.361252,37.479725,-8.361962,37.483909,-8.360845,37.484771,-8.354681,37.488434,-8.350574,37.486818,-8.346772,37.489562,-8.341675,37.494901,-8.341929,37.495555,-8.338603,37.495145,-8.332353,37.498235,-8.328822,37.498359,-8.322347,37.49964,-8.31579,37.503105,-8.310629,37.501201,-8.30543,37.497441,-8.308437,37.493229,-8.312452,37.490508,-8.318291,37.485718,-8.323031,37.483281,-8.325975,37.480969,-8.321812,37.477917,-8.317126&w=600&h=600&t=3&nord&m0=37.392353,-8.379645,37.477917,-8.317126&lc0=ff8dc72d&lw0=5
    The last bit defines a Width, height, Start and end markers, line colour and line width
    Code:
     w=600&h=600&t=3&nord&m0=37.392353,-8.379645,37.477917,-8.317126&lc0=ff8dc72d&lw0=5
    Then use this URL in an html <IMG> to embed a map into your report.
    I don't see why I can't, though the problem I'm having is how to utilize the geometry attribute. I'm assuming an array of some kind, but I am needing to pass in two searches to come up with the route between A and B, and then use geometry after the fact? Is it just a parameter?

    Sorry to be that guy.

  4. #4
    Nokia Developer Moderator jasfox's Avatar
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    225
    The problem is that there are usually a very large number of twists and turns in a geometry, and you only
    want an overview for a static image.

    Something like this will extract every nth Geocoordinate:

    Code:
    var onRouteCalculated = function (observedRouter, key, value) {
      if (value == "finished") {
    	    var routes = observedRouter.getRoutes();         
    	    geometry= routes[0].geometry;
    	    
    	    var geos = "http://m.nok.it/route?r0=";
    	    var step = Math.round(geometry.length/50) * 2; // Must be an even number
    	    var i = 0;
    	   
    	    while (   i < geometry.length ){
    	  			geos = geos + geometry.slice(i, i+2) + ","			
    	  			i = i + step; 
    	    }
    	    
    	  console.log(geos);
      
      } else if (value == "failed") {
          // Something has gone horribly wrong  e.g. route too long.
          alert("The routing request failed.");
      }
    };
    I guess you are making two requests to geocode the addresses and one to make the route request, a bit like this example: http://www.developer.nokia.com/Commu...vanced_Routing
    Jason Fox
    Technical Support Engineer, Maps Platform
    Location & Commerce

    http://developer.here.net/

Similar Threads

  1. My nokia n97 maps has no routes after formatting mass memory and factory settings.
    By MahmoudElhenawy in forum Geolocation and Navigation
    Replies: 3
    Last Post: 2009-10-01, 14:22
  2. Enumerating IP addresses
    By sysctl in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2006-09-23, 11:10
  3. WAP Gateway IP addresses
    By guyrogers in forum Mobile Web Site Development
    Replies: 0
    Last Post: 2002-10-29, 15:34

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved