Calculate Matrix addresses with limited land access - here-api

While using HERE's Calculate Matrix my team have encountered routes that are causing matrix calculations errors while using balanced routing mode.
Especially routes that are from Sweden to Great Britan.
start: [
{
id: 'sw',
latitude: 57.72994,
longitude: 11.94854
}
]
destination: [
{
id: 'gb',
latitude: 55.9007,
longitude: -3.64154
}
]
Example of sent request(provide your own appId and appCode):
https://matrix.route.api.here.com/routing/7.2/calculatematrix.json?app_id=yourappid&app_code=yourappcode&mode=truck;balanced;traffic:disabled;tollroad:0&motorway:0&boatFerry:0&tunnel:0&dirtRoad:0&park:0&start0=geo!57.72994%2C11.94854&destination0=geo!55.9007%2C-3.64154&summaryAttributes=traveltime&costfactor&distance
Response:
{
response: {
metaInfo: {
timestamp: "2019-08-06T07:53:21Z",
mapVersion: "8.30.99.152",
moduleVersion: "7.2.201930-4693",
interfaceVersion: "2.6.66",
availableMapVersion: ["8.30.99.152"]
},
matrixEntry: [
{ startIndex: 0,
destinationIndex: 0,
status: "failed"
}
]
}
}
Example with calculate route with no problem:
https://route.api.here.com/routing/7.2/calculateroute.json?app_code=pxIXqdtgOSwQDXSDfjLQpw&app_id=cgZPrYfgRePXzXC3PbBp&jsonattributes=41&language=en-us&length=0&limitedweight=0&maneuverattributes=po,ti,pt,ac,di,fj,ix&metricsystem=metric&mode=balanced;truck;traffic:disabled&routeattributes=sh,gr&waypoint0=geo!stopOver!57.72994,11.94854&waypoint1=geo!stopOver!55.9007,-3.64154;;End&width=0
I would like to know what is the reason this is happening and what our team can improve to get results for such routes

I don't have a solution, but I am currently encountering the same problem. It seems to originate from a select few address combinations. (see full response below; some start0 --> destination1 fails but destination1 --> start0 does not fail). I don't recall having encountered this problem before, while some of the locations currently throwing an error have been in my program before. Could it be something temporary?
{
'response': {
'metaInfo': {
'timestamp': '2019-08-06T09:00:32Z',
'mapVersion': '8.30.99.152',
'moduleVersion': '7.2.201930-4693',
'interfaceVersion': '2.6.66',
'availableMapVersion': ['8.30.99.152']
},
'matrixEntry': [{
'startIndex': 0,
'destinationIndex': 0,
'summary': {
'distance': 50,
'travelTime': 6,
'costFactor': 6
}
}, {
'startIndex': 0,
'destinationIndex': 1,
'status': 'failed'
}, {
'startIndex': 1,
'destinationIndex': 0,
'summary': {
'distance': 2617,
'travelTime': 327,
'costFactor': 327
}
}, {
'startIndex': 1,
'destinationIndex': 1,
'summary': {
'distance': 48,
'travelTime': 6,
'costFactor': 6
}
}]
}
}

Related

TypeError: Cannot read property 'days' of undefined in qml

Below is a snippet of my code in which I get the error above.days is nested model:
ApplicationWindow {
id:appWindow
width: 1000
height: 600
visible:true
flags:Qt.FramelessWindowHint
//color: "transparent"
property var monthName:0
property string notesText: monthlistModel.get(monthofdayCalendar.currentIndex).days.get(newdayCalendar.currentIndex).hours.get(dayList.currentIndex).notes
Settings {
property alias notesText: appWindow.notesText
}
Below is the listmodel with nested models:
ListModel{
id:monthlistModel
Component.onCompleted: {
let months = [
{
monthName: 0,
days: createDays(31)
},
{
monthName: 1,
days: createDays(29)
},
{
monthName:2,
days: createDays(31)
},
{
monthName: 3,
days: createDays(30)
},
{
monthName:4,
days: createDays(31)
},
{
monthName: 5,
days: createDays(30)
},
{
monthName: 6,
days: createDays(31)
},
{
monthName: 7,
days: createDays(31)
},
{
monthName:8,
days: createDays(30)
},
{
monthName: 9,
days: createDays(31)
},
{
monthName: 10,
days: createDays(30)
},
{
monthName: 11,
days: createDays(31)
}
]
append(months)
}
function createDays(dayCount) {
let days = []
for (let i = 0; i < dayCount+1; i++) {
days.push({
day: i ,
hours: createHours()
}
)
}
return days
}
function createHours() {
let hours = []
for (let i = 0; i < 25; i++) {
hours.push({
hour: i,
notes: ""
}
)
}
return hours
}
}
The application code is in below link
https://gist.github.com/cgiannakidis70/a5f0f73440013424fc0dedd7e3300f75
How to solve the above error?
Thanks in advance.
This is in heavy need of some refactoring in general.
That point aside, your ListModel should contain ListElements, not javascript objects and nested arrays. Might be worth a good readthrough on the ListModel documentation. Here's a somewhat-related question to help out a little more.

Why is this 5 body network constantly rotating?

I could not understand why this simple network configuration keeps spinning around node 2, except after some nudges around 30s mark in this screen cast, after which it restarts spinning. The setup uses visjs network module with forceatlas2 resolver.
My options param for the Network constructor is as follows:
get options(): Options {
return (
this.optionS || {
nodes: {
shape: 'dot',
size: 30,
font: {
size: 32
},
borderWidth: 2,
shadow: true
},
edges: {
width: 2,
shadow: true,
smooth: {
enabled: true,
roundness: 0.5,
type: 'cubicBezier',
forceDirection: 'vertical'
}
},
physics: {
forceAtlas2Based: {
avoidOverlap: 0.25,
gravitationalConstant: -95,
centralGravity: 0.01,
springLength: 100,
springConstant: 0.19,
nodeDistance: 175,
damping: 0.11
},
minVelocity: 0.75,
solver: 'forceAtlas2Based'
}
}
);
}
The host angular component provides these 5 nodes:
const nodes = new DataSet([
{ id: 1, label: 'Node 1' },
{ id: 2, label: 'Node 2' },
{ id: 3, label: 'Node 3' },
{ id: 4, label: 'Node 4' },
{ id: 5, label: 'Node 5' }
]);
const edges = new DataSet([
{ from: 1, to: 3 },
{ from: 1, to: 2 },
{ from: 2, to: 4 },
{ from: 2, to: 5 }
]);
this.graphData = { nodes, edges };
The network directive simply instantiates the Network as follows:
this.network = new Network(
this.el.nativeElement,
this.graphData,
this.options
);
Any insight into why this sort of perennial motion happens would be appreciated. I need to understand what factors to keep in mind for generating 'stable' nodes so that users do not have to keep chasing nodes/edges to click/interact with.
Increase minVelocity or damping to stop this.
The way you configured it the physics actually never stops moving the nodes around. Nodes 1, 2, 4 and 5 are kept in star arrangement by central gravity. Node 3 then pushes node 1 away but since everything's connected it ends up moving all of the nodes. Thanks to the edge between node 1 and 3 the force is stronger in one direction than the other. This then applies never ending force on the whole arrangement which ends up slowly spinning around node 2.
Faster spinner:

Kendo Diagram Shapes Centered

I'm following the example from the Telerik web site for Basic Usage with the exception of using a Model, children Heirarchy. I just want to be able to list shapes with text boxes and be able to connect them and get the connections later. So far, I'm able to list the shapes and the text boxes, but for some reason all the shapes get centered to the origin of the diagram. I'd like to be able to list the shapes in some order, without connections, then connect them later on on the diagram. Here is the code I have so far:
var data = [{
firstName: "Antonio",
lastName: "Moreno",
title: "Team Lead",
colorScheme: "#1696d3"
},
{
firstName: "Alfredo",
lastName: "Morales",
title: "Team Lead",
colorScheme: "#1696d3"
}];
function visualTemplate(options) {
var dataviz = kendo.dataviz;
var g = new dataviz.diagram.Group();
var dataItem = options.dataItem;
g.append(new dataviz.diagram.Rectangle({
width: 210,
height: 75,
stroke: {
width: 0
},
fill: {
gradient: {
type: "linear",
stops: [{
color: dataItem.colorScheme,
offset: 0,
opacity: 0.5
}, {
color: dataItem.colorScheme,
offset: 1,
opacity: 1
}]
}
}
}));
g.append(new dataviz.diagram.TextBlock({
text: dataItem.firstName + " " + dataItem.lastName,
x: 85,
y: 20,
fill: "#fff"
}));
g.append(new dataviz.diagram.TextBlock({
text: dataItem.title,
x: 85,
y: 40,
fill: "#fff"
}));
return g;
}
function createDiagram() {
$("#diagram").kendoDiagram({
dataSource: new kendo.data.HierarchicalDataSource({
data: data,
}),
shapeDefaults: {
visual: visualTemplate
},
});
var diagram = $("#diagram").getKendoDiagram();
diagram.bringIntoView(diagram.shapes);
}
$(document).ready(createDiagram);
I've made some sample: http://dojo.telerik.com/UbECE that makes rectangles one next to another.
I am following this example from API Documentation http://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/diagram#configuration-shapeDefaults.visual
They are using:
$("#diagram").getKendoDiagram().layout();
which works.
Your function will became:
function createDiagram() {
$("#diagram").kendoDiagram({
dataSource : data,
shapeDefaults: {
visual: visualTemplate
},
});
$("#diagram").getKendoDiagram().layout();
}

Firebase - Get all records which contains a key

I have a series of records in Firebase, like these:
{
records: {
n1: {
f1: 1,
f2: 0,
f3: 1
},
n2: {
f1: 0,
f4: 1,
f5: 0
}
}
}
I want, using an index, to get al records that contains the key f1 whatever its content might be (0 or 1)
There's a way to do this with Firebase?
Firebase Queries cannot test for the existence of a property, only for their value.
The easiest way to work around this limitation is to add a property with a value that signals the existence of the property you're looking for. Yeah... that is probably easier to understand with an example:
{
"records": {
"n1": {
"f1": 1,
"f2": 0,
"f3": 1,
"has_f1": true
},
"n2": {
"f1": 0,
"f4": 1,
"f5": 0,
"has_f1": true
},
"n3": {
"f7": 8,
"f8": 0
}
}
}
With this you can query:
ref.child('records')
.orderByChild('has_f1')
.equalTo(true)
.on('child_added', function(snapshot) {
console.log(snapshot.val());
})

highstock strange behavior scrollbar

i made a chart, with highstock, that contains the enabled scrollbar but when i focus the mouse on it, it happens a strange behavoir: the chart goes down and covers the scrollbar.
the options that i used are:
var options = {
chart: {
title: {
text: ''
},
renderTo: 'containerGrafico'
},
yAxis: {
title: '',
tickPixelInterval: 30,
labels: {
formatter: function () {
return '€ ' + Highcharts.numberFormat(this.value, 0);
}
}
},
xAxis: {
categories: seriesMesi,
labels: {
formatter: function () {
return arrayMesi[this.value.substring(4, 6)] + " " + this.value.substring(0, 4);
}
},
max: 6
},
scrollbar: {
enabled: true,
barBackgroundColor: 'transparent',
barBorderRadius: 7,
barBorderWidth: 0,
buttonBackgroundColor: 'gray',
buttonBorderWidth: 0,
buttonArrowColor: 'yellow',
buttonBorderRadius: 7,
rifleColor: 'transparent',
trackBackgroundColor: 'white',
trackBorderWidth: 1,
trackBorderColor: 'silver',
trackBorderRadius: 7
},
series: [
{
name: 'Totale Versato',
color: '#96B7D8',
type: 'column'
},
{
name: 'Prelievi',
color: '#D1D1D1',
type: 'column'
}]
};
anybody can tell me where i'm wrong?
thank you very much
Cinzia
In general, categorized axis for Highstock isn't supported.
Anyway, for me it works properly, see: http://jsfiddle.net/3bQne/1004/
Try to update to latest (1.3.10) version and remove categories. Or use Highcharts with categorized axis.
If none of above will help - recreate issue on jsFiddle.

Resources