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!
Re: Cognos Integration to display routes between two addresses
Assuming you can access the route's [B]geometry[/B] attribute, you are probably best off using the RESTful Maps API to embed a URL, just take every nth GeoCoordinate and append it after [B][url]http://m.nok.it/route?r0=[/url][/B]
[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
[/CODE]
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[/CODE]
Then use this URL in an html [B]<IMG>[/B] to embed a map into your report.
Re: Cognos Integration to display routes between two addresses
[QUOTE=jasfox;903907]Assuming you can access the route's [B]geometry[/B] attribute, you are probably best off using the RESTful Maps API to embed a URL, just take every nth GeoCoordinate and append it after [B][url]http://m.nok.it/route?r0=[/url][/B]
[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
[/CODE]
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[/CODE]
Then use this URL in an html [B]<IMG>[/B] to embed a map into your report.[/QUOTE]
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.
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 [B]geometry[/B], 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.");
}
};[/CODE]
I guess you are making two requests to geocode the addresses and one to make the route request, a bit like this example: [url]http://www.developer.nokia.com/Community/Wiki/Nokia_Maps_API_-_Advanced_Routing[/url]