×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Sep 2012
    Posts
    2

    Cognos Integration to display routes between two addresses

    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
    Regular Contributor
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    288

    Re: Cognos Integration to display routes between two addresses

    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.

  3. #3
    Registered User
    Join Date
    Sep 2012
    Posts
    2

    Re: Cognos Integration to display routes between two addresses

    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
    Regular Contributor
    Join Date
    Aug 2011
    Location
    Berlin
    Posts
    288

    Re: Cognos Integration to display routes between two addresses

    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

Similar Threads

  1. Enumerating IP addresses
    By sysctl in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2006-09-23, 11:10

Posting Permissions

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