Animate route on Google Maps - google-maps-api-3

Im looking for help/pointers on how to animate a route on Google Maps.
I don't want to animate the markers, just the route between 2 points, it needs to follow the roads on the map and preferably would work like a progress bar.
Does anyone know of any examples or a starting point

Here's a modified version of that site I linked to in my comment earlier. I've changed very little about this code, but it doesn't require Angular or jQuery.
<!DOCTYPE html>
<html>
<head>
<title>Animated route</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
html, body, #map {
height: 100%;
margin: 0px;
padding: 0px
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry"></script>
<script>
var map;
function initialize() {
var markLAT = coords[0].lat;
var markLNG = coords[0].lng;
map = new google.maps.Map(document.getElementById("map"), {
center: new google.maps.LatLng(markLAT, markLNG),
zoom: 11,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
autoRefresh();
}
google.maps.event.addDomListener(window, 'load', initialize);
var icon = new google.maps.MarkerImage("http://maps.google.com/mapfiles/ms/micons/blue.png");
function moveMarker(map, marker, lat, lon) {
marker.setPosition(new google.maps.LatLng(lat, lon));
map.panTo(new google.maps.LatLng(lat, lon));
}
function autoRefresh() {
var i, route, marker;
route = new google.maps.Polyline({
path: [],
geodesic : true,
strokeColor: '#FF0000',
strokeOpacity: 1.0,
strokeWeight: 2,
editable: false,
map:map
});
marker=new google.maps.Marker({map:map,icon:icon});
for (i = 0; i < coords.length; i++) {
setTimeout(function (coords)
{
route.getPath().push(new google.maps.LatLng(coords.lat, coords.lng));
moveMarker(map, marker, coords.lat, coords.lng);
}, 100 * i, coords[i]);
}
}
var coords = [
{
"lat": 8.893260000000001,
"lng": 76.61427
},
{
"lat": 8.894430000000002,
"lng": 76.61418
},
{
"lat": 8.89484,
"lng": 76.61416000000001
},
{
"lat": 8.894860000000001,
"lng": 76.61383000000001
},
{
"lat": 8.89488,
"lng": 76.61375000000001
},
{
"lat": 8.89563,
"lng": 76.61370000000001
},
{
"lat": 8.896270000000001,
"lng": 76.61366000000001
},
{
"lat": 8.896700000000001,
"lng": 76.61364
},
{
"lat": 8.89671,
"lng": 76.61351
},
{
"lat": 8.896740000000001,
"lng": 76.61312000000001
},
{
"lat": 8.89675,
"lng": 76.61307000000001
},
{
"lat": 8.89677,
"lng": 76.61305
},
{
"lat": 8.89729,
"lng": 76.61303000000001
},
{
"lat": 8.89755,
"lng": 76.61311
},
{
"lat": 8.898050000000001,
"lng": 76.61311
},
{
"lat": 8.898280000000002,
"lng": 76.61321000000001
},
{
"lat": 8.899180000000001,
"lng": 76.61289000000001
},
{
"lat": 8.900350000000001,
"lng": 76.61396
},
{
"lat": 8.900860000000002,
"lng": 76.61467
},
{
"lat": 8.90127,
"lng": 76.61581000000001
},
{
"lat": 8.901710000000001,
"lng": 76.61796000000001
},
{
"lat": 8.902190000000001,
"lng": 76.61932
},
{
"lat": 8.902370000000001,
"lng": 76.62017
},
{
"lat": 8.902370000000001,
"lng": 76.62088
},
{
"lat": 8.902460000000001,
"lng": 76.6212
},
{
"lat": 8.90313,
"lng": 76.62217000000001
},
{
"lat": 8.903450000000001,
"lng": 76.62240000000001
},
{
"lat": 8.903970000000001,
"lng": 76.62272
},
{
"lat": 8.90409,
"lng": 76.62280000000001
},
{
"lat": 8.904,
"lng": 76.62288000000001
},
{
"lat": 8.90342,
"lng": 76.6233
},
{
"lat": 8.902560000000001,
"lng": 76.62386000000001
},
{
"lat": 8.90033,
"lng": 76.62522000000001
},
{
"lat": 8.89601,
"lng": 76.62777000000001
},
{
"lat": 8.88676,
"lng": 76.63327000000001
},
{
"lat": 8.884450000000001,
"lng": 76.63461000000001
},
{
"lat": 8.882610000000001,
"lng": 76.63582000000001
},
{
"lat": 8.88089,
"lng": 76.63711
},
{
"lat": 8.87918,
"lng": 76.63862
},
{
"lat": 8.87785,
"lng": 76.63936000000001
},
{
"lat": 8.875760000000001,
"lng": 76.63996
},
{
"lat": 8.87273,
"lng": 76.64141000000001
},
{
"lat": 8.87067,
"lng": 76.64251
},
{
"lat": 8.869280000000002,
"lng": 76.64336
},
{
"lat": 8.86805,
"lng": 76.6447
},
{
"lat": 8.86782,
"lng": 76.6451
},
{
"lat": 8.86677,
"lng": 76.64822000000001
},
{
"lat": 8.86645,
"lng": 76.64933
},
{
"lat": 8.866200000000001,
"lng": 76.65092
},
{
"lat": 8.86546,
"lng": 76.6533
},
{
"lat": 8.86508,
"lng": 76.65451
},
{
"lat": 8.86495,
"lng": 76.65667
},
{
"lat": 8.864880000000001,
"lng": 76.65962
},
{
"lat": 8.86519,
"lng": 76.66080000000001
},
{
"lat": 8.866240000000001,
"lng": 76.66343
},
{
"lat": 8.86646,
"lng": 76.66454
},
{
"lat": 8.866200000000001,
"lng": 76.66933
},
{
"lat": 8.86569,
"lng": 76.67323
},
{
"lat": 8.86522,
"lng": 76.67823
},
{
"lat": 8.863840000000001,
"lng": 76.68872
},
{
"lat": 8.86359,
"lng": 76.6907
},
{
"lat": 8.86364,
"lng": 76.69282000000001
},
{
"lat": 8.86317,
"lng": 76.69574
},
{
"lat": 8.863420000000001,
"lng": 76.69850000000001
},
{
"lat": 8.8634,
"lng": 76.69958000000001
},
{
"lat": 8.863050000000001,
"lng": 76.70048000000001
},
{
"lat": 8.862350000000001,
"lng": 76.70149
},
{
"lat": 8.862020000000001,
"lng": 76.70239000000001
},
{
"lat": 8.86176,
"lng": 76.70448
},
{
"lat": 8.86218,
"lng": 76.70703
},
{
"lat": 8.863180000000002,
"lng": 76.70957
},
{
"lat": 8.8636,
"lng": 76.71115
},
{
"lat": 8.86382,
"lng": 76.71257
},
{
"lat": 8.86383,
"lng": 76.71368000000001
},
{
"lat": 8.86354,
"lng": 76.71509
},
{
"lat": 8.863240000000001,
"lng": 76.71595
},
{
"lat": 8.86259,
"lng": 76.71731000000001
},
{
"lat": 8.861540000000002,
"lng": 76.71883000000001
},
{
"lat": 8.85947,
"lng": 76.72208
},
{
"lat": 8.85875,
"lng": 76.72339000000001
},
{
"lat": 8.8573,
"lng": 76.72554000000001
},
{
"lat": 8.85478,
"lng": 76.72876000000001
},
{
"lat": 8.85397,
"lng": 76.72962000000001
},
{
"lat": 8.8518,
"lng": 76.73123000000001
},
{
"lat": 8.851220000000001,
"lng": 76.73173000000001
},
{
"lat": 8.850200000000001,
"lng": 76.73293000000001
},
{
"lat": 8.84966,
"lng": 76.73342000000001
},
{
"lat": 8.848920000000001,
"lng": 76.73382000000001
},
{
"lat": 8.84797,
"lng": 76.73409000000001
},
{
"lat": 8.84509,
"lng": 76.73453
},
{
"lat": 8.843850000000002,
"lng": 76.73492
},
{
"lat": 8.84294,
"lng": 76.73541
},
{
"lat": 8.841140000000001,
"lng": 76.73677
},
{
"lat": 8.84003,
"lng": 76.73747
},
{
"lat": 8.838830000000002,
"lng": 76.73848000000001
},
{
"lat": 8.836,
"lng": 76.73998
},
{
"lat": 8.835310000000002,
"lng": 76.74063000000001
},
{
"lat": 8.83496,
"lng": 76.74137
},
{
"lat": 8.834480000000001,
"lng": 76.74313000000001
},
{
"lat": 8.83385,
"lng": 76.74406
},
{
"lat": 8.832690000000001,
"lng": 76.74528000000001
},
{
"lat": 8.83188,
"lng": 76.74599
},
{
"lat": 8.830480000000001,
"lng": 76.7467
},
{
"lat": 8.82831,
"lng": 76.74775000000001
},
{
"lat": 8.82764,
"lng": 76.74836
},
{
"lat": 8.82665,
"lng": 76.7493
},
{
"lat": 8.82475,
"lng": 76.7505
},
{
"lat": 8.82245,
"lng": 76.75188
},
{
"lat": 8.82136,
"lng": 76.75254000000001
},
{
"lat": 8.819880000000001,
"lng": 76.75371000000001
},
{
"lat": 8.818140000000001,
"lng": 76.75496000000001
},
{
"lat": 8.815700000000001,
"lng": 76.75652000000001
},
{
"lat": 8.8125,
"lng": 76.75867000000001
},
{
"lat": 8.809470000000001,
"lng": 76.76091000000001
},
{
"lat": 8.806270000000001,
"lng": 76.76203000000001
},
{
"lat": 8.804110000000001,
"lng": 76.763
},
{
"lat": 8.803410000000001,
"lng": 76.76368000000001
},
{
"lat": 8.802990000000001,
"lng": 76.76439
},
{
"lat": 8.8024,
"lng": 76.76629000000001
},
{
"lat": 8.80207,
"lng": 76.76687000000001
},
{
"lat": 8.801540000000001,
"lng": 76.76747
},
{
"lat": 8.79983,
"lng": 76.76870000000001
},
{
"lat": 8.799180000000002,
"lng": 76.76894
},
{
"lat": 8.798390000000001,
"lng": 76.76903
},
{
"lat": 8.79742,
"lng": 76.76905000000001
},
{
"lat": 8.795710000000001,
"lng": 76.76929000000001
},
{
"lat": 8.79439,
"lng": 76.76955000000001
},
{
"lat": 8.79053,
"lng": 76.77083
},
{
"lat": 8.78954,
"lng": 76.77144000000001
},
{
"lat": 8.788820000000001,
"lng": 76.77241000000001
},
{
"lat": 8.78842,
"lng": 76.77367000000001
},
{
"lat": 8.78814,
"lng": 76.77574000000001
},
{
"lat": 8.78767,
"lng": 76.77690000000001
},
{
"lat": 8.78735,
"lng": 76.77735000000001
},
{
"lat": 8.78688,
"lng": 76.77771000000001
},
{
"lat": 8.78307,
"lng": 76.78025000000001
},
{
"lat": 8.779250000000001,
"lng": 76.78346
},
{
"lat": 8.77712,
"lng": 76.78488
},
{
"lat": 8.77275,
"lng": 76.78745
},
{
"lat": 8.770980000000002,
"lng": 76.78802
},
{
"lat": 8.76699,
"lng": 76.78881000000001
},
{
"lat": 8.765640000000001,
"lng": 76.78967
},
{
"lat": 8.76401,
"lng": 76.79095000000001
},
{
"lat": 8.763190000000002,
"lng": 76.79128
},
{
"lat": 8.76102,
"lng": 76.79195
},
{
"lat": 8.7558,
"lng": 76.79388
},
{
"lat": 8.75234,
"lng": 76.79589
},
{
"lat": 8.750900000000001,
"lng": 76.79650000000001
},
{
"lat": 8.75009,
"lng": 76.79726000000001
},
{
"lat": 8.748840000000001,
"lng": 76.79895
},
{
"lat": 8.747110000000001,
"lng": 76.80017000000001
},
{
"lat": 8.74582,
"lng": 76.80142000000001
},
{
"lat": 8.74407,
"lng": 76.80305000000001
},
{
"lat": 8.74125,
"lng": 76.80436
},
{
"lat": 8.73728,
"lng": 76.80730000000001
},
{
"lat": 8.73624,
"lng": 76.80879
},
{
"lat": 8.73544,
"lng": 76.80953000000001
},
{
"lat": 8.732800000000001,
"lng": 76.8109
},
{
"lat": 8.731950000000001,
"lng": 76.8113
},
{
"lat": 8.730500000000001,
"lng": 76.81166
},
{
"lat": 8.72644,
"lng": 76.81249000000001
},
{
"lat": 8.723980000000001,
"lng": 76.81252
},
{
"lat": 8.72197,
"lng": 76.81271000000001
},
{
"lat": 8.720460000000001,
"lng": 76.81268
},
{
"lat": 8.71958,
"lng": 76.81273
},
{
"lat": 8.71719,
"lng": 76.81297
},
{
"lat": 8.71636,
"lng": 76.81293000000001
},
{
"lat": 8.714080000000001,
"lng": 76.81215
},
{
"lat": 8.713080000000001,
"lng": 76.81175
},
{
"lat": 8.71254,
"lng": 76.8117
},
{
"lat": 8.71188,
"lng": 76.81176
},
{
"lat": 8.71118,
"lng": 76.81200000000001
},
{
"lat": 8.70936,
"lng": 76.81330000000001
},
{
"lat": 8.70716,
"lng": 76.81486000000001
},
{
"lat": 8.70616,
"lng": 76.81506
},
{
"lat": 8.70514,
"lng": 76.81497
},
{
"lat": 8.70363,
"lng": 76.81461
},
{
"lat": 8.70148,
"lng": 76.81371
},
{
"lat": 8.70063,
"lng": 76.81357000000001
},
{
"lat": 8.70003,
"lng": 76.81360000000001
},
{
"lat": 8.698400000000001,
"lng": 76.81366000000001
},
{
"lat": 8.698210000000001,
"lng": 76.81378000000001
},
{
"lat": 8.69705,
"lng": 76.81499000000001
},
{
"lat": 8.696520000000001,
"lng": 76.81584000000001
},
{
"lat": 8.69635,
"lng": 76.81654
},
{
"lat": 8.695580000000001,
"lng": 76.8182
},
{
"lat": 8.69529,
"lng": 76.81865
},
{
"lat": 8.694780000000002,
"lng": 76.81908
},
{
"lat": 8.69355,
"lng": 76.81999
},
{
"lat": 8.6928,
"lng": 76.82099000000001
},
{
"lat": 8.691880000000001,
"lng": 76.82178
},
{
"lat": 8.690430000000001,
"lng": 76.82248000000001
},
{
"lat": 8.68914,
"lng": 76.82319000000001
},
{
"lat": 8.68819,
"lng": 76.82406
},
{
"lat": 8.68773,
"lng": 76.82423
},
{
"lat": 8.68612,
"lng": 76.82438
},
{
"lat": 8.68462,
"lng": 76.82435000000001
},
{
"lat": 8.68229,
"lng": 76.82445000000001
},
{
"lat": 8.68044,
"lng": 76.82475000000001
},
{
"lat": 8.67947,
"lng": 76.8251
},
{
"lat": 8.678650000000001,
"lng": 76.82560000000001
},
{
"lat": 8.678180000000001,
"lng": 76.82599
},
{
"lat": 8.67652,
"lng": 76.82787
},
{
"lat": 8.67533,
"lng": 76.82933000000001
},
{
"lat": 8.67463,
"lng": 76.83056
},
{
"lat": 8.6738,
"lng": 76.83302
},
{
"lat": 8.67337,
"lng": 76.83368
},
{
"lat": 8.67276,
"lng": 76.83424000000001
},
{
"lat": 8.67102,
"lng": 76.83500000000001
},
{
"lat": 8.669350000000001,
"lng": 76.83574
},
{
"lat": 8.6684,
"lng": 76.83630000000001
},
{
"lat": 8.665890000000001,
"lng": 76.83818000000001
},
{
"lat": 8.66487,
"lng": 76.83893
},
{
"lat": 8.66254,
"lng": 76.83997000000001
},
{
"lat": 8.66042,
"lng": 76.8408
},
{
"lat": 8.65906,
"lng": 76.84094
},
{
"lat": 8.65737,
"lng": 76.84088000000001
},
{
"lat": 8.655100000000001,
"lng": 76.84037000000001
},
{
"lat": 8.654060000000001,
"lng": 76.84041
},
{
"lat": 8.65291,
"lng": 76.84082000000001
},
{
"lat": 8.65094,
"lng": 76.84149000000001
},
{
"lat": 8.647400000000001,
"lng": 76.84214
},
{
"lat": 8.64208,
"lng": 76.84372
},
{
"lat": 8.63718,
"lng": 76.84567000000001
},
{
"lat": 8.633890000000001,
"lng": 76.84642000000001
},
{
"lat": 8.63049,
"lng": 76.84713
},
{
"lat": 8.62597,
"lng": 76.84825000000001
},
{
"lat": 8.62233,
"lng": 76.84888000000001
},
{
"lat": 8.61796,
"lng": 76.85015
},
{
"lat": 8.61705,
"lng": 76.85052
},
{
"lat": 8.611970000000001,
"lng": 76.85444000000001
},
{
"lat": 8.609100000000002,
"lng": 76.85662
},
{
"lat": 8.60847,
"lng": 76.85691000000001
},
{
"lat": 8.60748,
"lng": 76.85704000000001
},
{
"lat": 8.604790000000001,
"lng": 76.85632000000001
},
{
"lat": 8.60331,
"lng": 76.85583000000001
},
{
"lat": 8.601980000000001,
"lng": 76.85521
},
{
"lat": 8.60084,
"lng": 76.85462000000001
},
{
"lat": 8.599530000000001,
"lng": 76.85423
},
{
"lat": 8.598180000000001,
"lng": 76.85446
},
{
"lat": 8.59272,
"lng": 76.85616
},
{
"lat": 8.58853,
"lng": 76.85780000000001
},
{
"lat": 8.587850000000001,
"lng": 76.85819000000001
},
{
"lat": 8.58651,
"lng": 76.85957
},
{
"lat": 8.58371,
"lng": 76.86185
},
{
"lat": 8.58211,
"lng": 76.86330000000001
},
{
"lat": 8.57942,
"lng": 76.86524
},
{
"lat": 8.57592,
"lng": 76.86807
},
{
"lat": 8.57488,
"lng": 76.86879
},
{
"lat": 8.573540000000001,
"lng": 76.86953000000001
},
{
"lat": 8.57169,
"lng": 76.87060000000001
},
{
"lat": 8.56986,
"lng": 76.87212000000001
},
{
"lat": 8.56779,
"lng": 76.87364000000001
},
{
"lat": 8.56587,
"lng": 76.87492
},
{
"lat": 8.56545,
"lng": 76.8755
},
{
"lat": 8.565230000000001,
"lng": 76.87642000000001
},
{
"lat": 8.56508,
"lng": 76.87809
},
{
"lat": 8.5647,
"lng": 76.88276
},
{
"lat": 8.56473,
"lng": 76.88329
},
{
"lat": 8.56521,
"lng": 76.88474000000001
},
{
"lat": 8.56591,
"lng": 76.88702
},
{
"lat": 8.566840000000001,
"lng": 76.88966
},
{
"lat": 8.566930000000001,
"lng": 76.89045
},
{
"lat": 8.56609,
"lng": 76.89177000000001
},
{
"lat": 8.564670000000001,
"lng": 76.89337
},
{
"lat": 8.56283,
"lng": 76.89437000000001
},
{
"lat": 8.56193,
"lng": 76.89489
},
{
"lat": 8.5616,
"lng": 76.89528
},
{
"lat": 8.561290000000001,
"lng": 76.89592
},
{
"lat": 8.560770000000002,
"lng": 76.89757
},
{
"lat": 8.5608,
"lng": 76.89906
},
{
"lat": 8.56107,
"lng": 76.90019000000001
},
{
"lat": 8.560960000000001,
"lng": 76.90051000000001
},
{
"lat": 8.560640000000001,
"lng": 76.90077000000001
},
{
"lat": 8.560080000000001,
"lng": 76.90137
},
{
"lat": 8.559880000000001,
"lng": 76.90159000000001
},
{
"lat": 8.55888,
"lng": 76.90188
},
{
"lat": 8.557310000000001,
"lng": 76.90271000000001
},
{
"lat": 8.55607,
"lng": 76.90337000000001
},
{
"lat": 8.55532,
"lng": 76.90364000000001
},
{
"lat": 8.554450000000001,
"lng": 76.90429
},
{
"lat": 8.55367,
"lng": 76.90523
},
{
"lat": 8.552750000000001,
"lng": 76.90672
},
{
"lat": 8.55192,
"lng": 76.90914000000001
},
{
"lat": 8.551060000000001,
"lng": 76.91055
},
{
"lat": 8.55096,
"lng": 76.91157000000001
},
{
"lat": 8.55077,
"lng": 76.91293
},
{
"lat": 8.549750000000001,
"lng": 76.91429000000001
},
{
"lat": 8.54897,
"lng": 76.91604000000001
},
{
"lat": 8.54884,
"lng": 76.91713
},
{
"lat": 8.54833,
"lng": 76.91862
},
{
"lat": 8.548340000000001,
"lng": 76.91954000000001
},
{
"lat": 8.548340000000001,
"lng": 76.92013
},
{
"lat": 8.548150000000001,
"lng": 76.92067
},
{
"lat": 8.54765,
"lng": 76.92168000000001
},
{
"lat": 8.547320000000001,
"lng": 76.92183
},
{
"lat": 8.546460000000002,
"lng": 76.92172000000001
},
{
"lat": 8.54588,
"lng": 76.92167
},
{
"lat": 8.545010000000001,
"lng": 76.92194
},
{
"lat": 8.54223,
"lng": 76.92337
},
{
"lat": 8.54024,
"lng": 76.92455000000001
},
{
"lat": 8.539470000000001,
"lng": 76.92527000000001
},
{
"lat": 8.53843,
"lng": 76.92589000000001
},
{
"lat": 8.536340000000001,
"lng": 76.92666000000001
},
{
"lat": 8.535070000000001,
"lng": 76.92738
}
];
</script>
</head>
<body>
<div id="map"></div>
</body>
</html>

Related

Spatial Search in Here Data Hub not working

I have created a space in Here DataHub and multiple features in it. The format of feature is -
{
"type": "Feature",
"id": "5mmUm99MMRp7TSfO",
"geometry": {
"type": "Point",
"bbox": null,
"coordinates": [
-2.960847,
53.430828,
0.0
]
},
"properties": {
"#ns:com:here:xyz": {
"space": "4XICUXLX",
"createdAt": 1648724559819,
"updatedAt": 1648724559819,
"uuid": null,
"puuid": null,
"muuid": null,
"tags": [
"car",
"sedan"
]
},
"featureName": "4b44eab9-d030-44b5-9330-66132766666b",
"lon": 53.430828,
"geometry": {
"type": "Point",
"coordinates": {
"lat": -2.960847,
"lon": 53.430828
}
},
"lat": -2.960847
}
}
There are multiple features with these coordinates of lat and lon.
I want to search for features in the spatial in a radius of x m.
After executing spatial search APi result is empty, it contains no features -
curl -X GET "https://xyz.api.here.com/hub/spaces/4XICUXLX/spatial?lat=-2.960847&lon=53.430828&radius=0&limit=100&p.lat=-2.960847&p.lon=53.430828" -H "accept: application/geo+json"
Result - { "type": "FeatureCollection", "etag": "\"b4ce422e09aaae1bb21bd51e8e3029bf\"", "features": [] }
When I search for features in general by property by calling search API -
https://xyz.api.here.com/hub/spaces/4XICUXLX/search?p.lat=-2.960847&p.lon=53.430828
Response is list of features having that coordinate -
{
"type": "FeatureCollection",
"etag": "\"ce76cc9fbba2305d0f6c182237a6d316\"",
"features": [
{
"id": "5mmUm99MMRp7TSfO",
"type": "Feature",
"properties": {
"lat": -2.960847,
"lon": 53.430828,
"geometry": {
"type": "Point",
"coordinates": {
"lat": -2.960847,
"lon": 53.430828
}
},
"featureName": "4b44eab9-d030-44b5-9330-66132766666b",
"#ns:com:here:xyz": {
"tags": [
"car",
"sedan"
],
"space": "4XICUXLX",
"createdAt": 1648724559819,
"updatedAt": 1648724559819
}
},
"geometry": {
"type": "Point",
"coordinates": [
-2.960847,
53.430828,
0
]
}
},
{
"id": "asojLXk2T8h1A0uR",
"type": "Feature",
"properties": {
"lat": -2.960847,
"lon": 53.430828,
"geometry": {
"type": "Point",
"coordinates": {
"lat": -2.960847,
"lon": 53.430828
}
},
"featureName": "e251e750-fcd0-484d-9c75-eda54601784d",
"#ns:com:here:xyz": {
"tags": [
"car",
"sedan"
],
"space": "4XICUXLX",
"createdAt": 1648722389306,
"updatedAt": 1648722389306
}
},
"geometry": {
"type": "Point",
"coordinates": [
-2.960847,
53.430828,
0
]
}
}
]
}
Can anyone please help me with what is wrong in the spatial API call/query? Why results are not coming in it?

Turn-by-turn latitude and longitude on HERE Routing API

I want to get the latitude and longitude per instruction on the actions I get from HERE Routing API v8. I get the maneuvers from HERE Routing v7 but not on v8. I tried all the return values.
https://router.hereapi.com/v8/routes?apikey=APIKEY&origin=14.57755,121.04239&destination=14.57735,121.04274&return=polyline,summary,actions,instructions&spans=segmentId&transportMode=car
{
"routes": [{
"id": "bae447cc-a31f-48f7-83a7-2c73c34d492d",
"sections": [{
"id": "152087e3-7f61-451e-b764-e88583586f10",
"type": "vehicle",
"actions": [{
"action": "depart",
"duration": 10,
"length": 76,
"instruction": "Head toward Camiguin on Barangka Dr. Go for 76 m.",
"offset": 0
},
{
"action": "continue",
"duration": 22,
"length": 102,
"instruction": "Continue on 9 de Febrero toward Ortigas Ave/Shaw Blvd. Go for 102 m.",
"offset": 3
},
{
"action": "turn",
"duration": 12,
"length": 53,
"instruction": "Turn right onto Talumpong. Go for 53 m.",
"offset": 7,
"direction": "right",
"severity": "quite"
},
{
"action": "turn",
"duration": 29,
"length": 149,
"instruction": "Turn right onto Tabayog. Go for 149 m.",
"offset": 8,
"direction": "right",
"severity": "quite"
},
{
"action": "arrive",
"duration": 0,
"length": 0,
"instruction": "Arrive at Tabayog. Your destination is on the left.",
"offset": 13
}
],
"departure": {
"time": "2022-02-03T18:59:50+08:00",
"place": {
"type": "place",
"location": {
"lat": 14.5775706,
"lng": 121.0423584
},
"originalLocation": {
"lat": 14.5775499,
"lng": 121.04239
}
}
},
"arrival": {
"time": "2022-02-03T19:01:03+08:00",
"place": {
"type": "place",
"location": {
"lat": 14.5773811,
"lng": 121.0426889
},
"originalLocation": {
"lat": 14.5773499,
"lng": 121.04274
}
}
},
"summary": {
"duration": 73,
"length": 380,
"baseDuration": 65
},
"polyline": "BGm635bs767mHiS0MsEkD8L0KgF0FsEoGgF4IoQsdvb8L3IvRnQze3IvHzK3I9ElD",
"spans": [{
"offset": 0,
"topologySegmentId": "+here:cm:segment:46864687"
},
{
"offset": 3,
"topologySegmentId": "+here:cm:segment:47392105"
},
{
"offset": 7,
"topologySegmentId": "-here:cm:segment:26196228"
},
{
"offset": 8,
"topologySegmentId": "-here:cm:segment:23767715"
},
{
"offset": 10,
"topologySegmentId": "-here:cm:segment:21101714"
}
],
"language": "en-us",
"transport": {
"mode": "car"
}
}],
}],
}
As of 2nd day of February 2022, the position paremeter that outputs latitude and longitude in v7 is not supported in v8 under maneuverAttributes. Source
That is correct in routing V8, there is an offset into polyline in maneuver. Offset is the index into the polyline and all coordinates in V8 work this way. spans, actions, they have offset into the route shape which is an array of coordinates. Example: https://demo.routing.ext.here.com/#url=https://router.hereapi.com/v8/routes?apikey=DEFAULT_API_KEY&origin=52.551325,13.351349&destination=52.514255,13.34929&return=polyline,summary,actions,instructions&transportMode=car

Here Waypoint Sequencing API Doesn't Honor Delivery Windows

I am experimenting with the HERE Waypoint Sequencing API using the new JSON request format, and it doesn't seem to take into account delivery windows specified in the times array within the plan object. I went back to the example provided in the documentation and found that the same thing was happening: Arrival and departure times are far from the specified delivery windows.
In my Example, Customer 1 has times:
"times": [["2020-07-04T08:00:00Z","2020-07-04T10:00:00Z"],["2020-07-04T16:00:00Z","2020-07-04T18:00:00Z"]]
However, the solution contains:
"time": {
"arrival": "2020-07-04T00:30:00.000+0000",
"departure": "2020-07-04T00:33:00.000+0000"
}
Which isn't even close.
Endpoint: https://wps.hereapi.com/v8/findsequence
Request:
{
"configuration": {
"optimizations": {
"traffic": "liveOrHistorical",
"waitingTime": {
"bufferTime": 15,
"reduce": false
}
}
},
"fleet": {
"profiles": [{"type":"car","name":"normal_car"}],
"types": [
{
"amount": 1,
"capacity": [10,5],
"costs": {
"distance": 0.0001,
"fixed": 22,
"time": 0.0048
},
"id": "string",
"limits": {
"maxDistance": 20000,
"shiftTime": 21600
},
"profile": "normal_car",
"shifts": [
{
"breaks": [
{
"duration": 180,
"location": {
"lat": 52.53088,
"lng": 13.38471
},
"times": [["2020-07-04T08:00:00Z","2020-07-04T10:00:00Z"],["2020-07-04T16:00:00Z","2020-07-04T18:00:00Z"]]
}
],
"end": {
"location": {
"lat": 52.53088,
"lng": 13.38471
},
"time": "2020-07-04T23:30:00Z"
},
"start": {
"location": {
"lat": 52.53088,
"lng": 13.38471
},
"time": "2020-07-04T00:30:00Z"
}
}
],
"skills": ["fridge"]
}
]
},
"id": "7f3423c2-784a-4983-b472-e14107d5a54a",
"plan": {
"jobs": [
{
"id": "string",
"places": {
"deliveries": [
{
"demand": [10,5],
"duration": 180,
"location": {
"lat": 52.53088,
"lng": 13.38471
},
"tag": "Customer 1",
"times": [["2020-07-04T08:00:00Z","2020-07-04T10:00:00Z"],["2020-07-04T16:00:00Z","2020-07-04T18:00:00Z"]]
},
{
"demand": [10,5],
"duration": 180,
"location": {
"lat": 53.53088,
"lng": 14.98471
},
"tag": "Customer 2",
"times": [["2020-07-04T08:00:00Z","2020-07-04T10:00:00Z"],["2020-07-04T16:00:00Z","2020-07-04T18:00:00Z"]]
}
],
"pickups": [
{
"demand": [10,5],
"duration": 180,
"location": {
"lat": 52.53088,
"lng": 13.98471
},
"tag": "some_tag",
"times": [["2020-07-04T08:00:00Z","2020-07-04T10:00:00Z"],["2020-07-04T16:00:00Z","2020-07-04T18:00:00Z"]]
}
]
},
"skills": ["fridge"]
}
],
"relations": [
{
"jobs": [
"string"
],
"type": "flexible",
"vehicleId": "7f3423c2-784a-4983-b472-e14107d5a54a"
}
]
}
}
Response:
{
"problemId": "7f3423c2-784a-4983-b472-e14107d5a54a",
"statistic": {
"cost": null,
"distance": 441655,
"duration": 20127,
"times": {
"break": 0,
"driving": 19587,
"serving": 540,
"waiting": 0
}
},
"tours": [
{
"vehicleId": "string",
"typeId": null,
"stops": [
{
"location": {
"lat": 52.53088,
"lng": 13.38471
},
"time": {
"arrival": null,
"departure": "2020-07-04T00:30:00.000+0000"
},
"load": [
],
"activities": [
{
"jobId": "departure",
"jobTag": "departure",
"type": null,
"location": null,
"time": null
}
]
},
{
"location": {
"lat": 52.53088,
"lng": 13.38471
},
"time": {
"arrival": "2020-07-04T00:30:00.000+0000",
"departure": "2020-07-04T00:33:00.000+0000"
},
"load": [
],
"activities": [
{
"jobId": "Customer 1",
"jobTag": "Customer 1",
"type": null,
"location": null,
"time": null
}
]
},
{
"location": {
"lat": 52.53088,
"lng": 13.98471
},
"time": {
"arrival": "2020-07-04T01:34:05.000+0000",
"departure": "2020-07-04T01:37:05.000+0000"
},
"load": [
],
"activities": [
{
"jobId": "some_tag",
"jobTag": "some_tag",
"type": null,
"location": null,
"time": null
}
]
},
{
"location": {
"lat": 53.53088,
"lng": 14.98471
},
"time": {
"arrival": "2020-07-04T03:53:37.000+0000",
"departure": "2020-07-04T03:56:37.000+0000"
},
"load": [
],
"activities": [
{
"jobId": "Customer 2",
"jobTag": "Customer 2",
"type": null,
"location": null,
"time": null
}
]
},
{
"location": {
"lat": 52.53088,
"lng": 13.38471
},
"time": {
"arrival": "2020-07-04T06:05:27.000+0000",
"departure": null
},
"load": [
],
"activities": [
{
"jobId": "arrival",
"jobTag": "arrival",
"type": null,
"location": null,
"time": null
}
]
}
],
"statistic": {
"cost": null,
"distance": 441655,
"duration": 20127,
"times": {
"break": 0,
"driving": 19587,
"serving": 540,
"waiting": 0
}
}
}
],
"unassigned": null
}
Am I missing something?

Address in autocomplete results

When I do an autosuggest request in the address response I only receive the label. The address object is not filled.
This is my request: https://autosuggest.search.hereapi.com/v1/autosuggest?at=48.8578817,2.2791249999999934&limit=5&q=stj&apikey=xxxx
I receive this:
"title": "Top Services (Stj)",
"id": "here:pds:place:250u09wj-afceace0a11b49bca950ea22d0f8e452",
"resultType": "place",
"address": {
"label": "********"
},
I will need to receive the formatted address without the name
How can I fix this?
thanks
We have tried to reproduce your query and it works for us, please see the following code.
Please review the documentation page for detailed information on autosuggest
Documentation link :
https://autosuggest.search.hereapi.com/v1/autosuggest?at=48.8578817,2.2791249999999934&limit=5&q=stj&apikey=XXXX.
Query Result:
{
"items": [
{
"title": "Top Services (Stj)",
"id": "here:pds:place:250u09wj-afceace0a11b49bca950ea22d0f8e452",
"resultType": "place",
"address": {
"label": "Top Services, 61 Rue du Faubourg Saint-Denis, 75010 Paris, France"
},
"position": {
"lat": 48.8721,
"lng": 2.35384
},
"access": [
{
"lat": 48.87208,
"lng": 2.35392
}
],
"distance": 5690,
"categories": [
{
"id": "700-7200-0254",
"name": "Construction",
"primary": true
},
{
"id": "700-7200-0264",
"name": "Services de conseil et de gestion"
},
{
"id": "700-7200-0277",
"name": "Entrepreneur de second œuvre"
}
],
"highlights": {
"title": [
{
"start": 14,
"end": 17
}
],
"address": {
"label": [
]
}
}
},
{
"title": "La Clinique du Scooter d'Occasion (Stj 2 Roues)",
"id": "here:pds:place:250u09tv-591de1b090c54199b11154a72f462c0d",
"resultType": "place",
"address": {
"label": "La Clinique du Scooter d'Occasion, 148 Boulevard du Montparnasse, 75014 Paris, France"
},
"position": {
"lat": 48.84039,
"lng": 2.33383
},
"access": [
{
"lat": 48.84052,
"lng": 2.33393
}
],
"distance": 4451,
"categories": [
{
"id": "400-4200-0241",
"name": "Services logistiques",
"primary": true
}
],
"highlights": {
"title": [
{
"start": 35,
"end": 38
}
],
"address": {
"label": [
]
}
}
},
{
"title": "Stjohn's",
"id": "here:pds:place:2501r4ve-43f913ba8f9b0e7046aaee61bcfe8b9b",
"resultType": "place",
"address": {
"label": "Stjohn's, 11 Rue Edmond Valentin, 75007 Paris, France"
},
"position": {
"lat": 48.85961,
"lng": 2.30159
},
"access": [
{
"lat": 48.85968,
"lng": 2.30157
}
],
"distance": 1655,
"categories": [
{
"id": "700-7400-0141",
"name": "Services aux entreprises",
"primary": true
},
{
"id": "700-7200-0252",
"name": "Publicité, marketing, communication et études de marché"
}
],
"highlights": {
"title": [
{
"start": 0,
"end": 3
}
],
"address": {
"label": [
{
"start": 0,
"end": 3
}
]
}
}
},
{
"title": "Stjohn S",
"id": "here:pds:place:250u09tv-0f38e06dd8634ab4a0d931dad94de24c",
"resultType": "place",
"address": {
"label": "Stjohn S, 4 Rue des Petits-Pères, 75002 Paris, France"
},
"position": {
"lat": 48.86601,
"lng": 2.34027
},
"access": [
{
"lat": 48.8662,
"lng": 2.34023
}
],
"distance": 4564,
"categories": [
{
"id": "700-7200-0252",
"name": "Publicité, marketing, communication et études de marché",
"primary": true
},
{
"id": "700-7200-0271",
"name": "Services financiers et d'assurance"
}
],
"highlights": {
"title": [
{
"start": 0,
"end": 3
}
],
"address": {
"label": [
{
"start": 0,
"end": 3
}
]
}
}
},
{
"title": "Espace St-Jo'",
"id": "here:pds:place:250u09te-220742c64e4a40a48b8772987e7f987c",
"resultType": "place",
"address": {
"label": "Espace St-Jo', 54 Rue du Moulin de Pierres, 92140 Clamart, France"
},
"position": {
"lat": 48.80865,
"lng": 2.26594
},
"access": [
{
"lat": 48.8087,
"lng": 2.2659
}
],
"distance": 5558,
"categories": [
{
"id": "200-2200-0000",
"name": "Théâtre, musique et culture",
"primary": true
},
{
"id": "200-2000-0015",
"name": "Salle de spectacle/concert"
},
{
"id": "550-5520-0000",
"name": "Aire de loisirs"
}
],
"references": [
{
"supplier": {
"id": "yelp"
},
"id": "xJtl5krT8OZ3QYXtMl6Leg"
}
],
"highlights": {
"title": [
{
"start": 7,
"end": 12
}
],
"address": {
"label": [
{
"start": 7,
"end": 12
}
]
}
}
}
],
"queryTerms": [
]
}

Why is averageRating always 0?

I am using the 'Explore Popular Places by Category' API and it always returns averageRating as 0 for all items in the result.
I made this call with various categories such as restaurants and sights-museums, but it always returns 0 for averageRating. Does HERE not provide this detail, and if so, why is it returned in the response?
Some details:
I am making a call to this url:
https://places.ls.hereapi.com/places/v1/discover/explore?at=52.5159%2C13.3777&cat=sights-museums&apiKey={api_key}
and it returns something like this:
{
"results": {
"next": "https://places.ls.hereapi.com/places/v1/discover/explore;context=Y2F0PXNpZ2h0cy1tdXNldW1zJmZsb3ctaWQ9Mjk0ZjU1NTgtMmY0Mi01Y2FiLWJlYWUtOGEyM2ViY2EzMzgzXzE1ODMyNjMyNjEwMzZfMF84NTcyJm9mZnNldD0yMCZzaXplPTIw?at=52.5159%2C13.3777&app_id=LKO34glU2MBEVbcOD5mQ&app_code=A2ta_nQ8HRYwenju5HFG5Q",
"items": [
{
"position": [
52.51629,
13.37817
],
"distance": 54,
"title": "Brandenburg Gate",
"averageRating": 0,
"category": {
"id": "landmark-attraction",
"title": "Landmark/Attraction",
"href": "https://places.ls.hereapi.com/places/v1/categories/places/landmark-attraction?app_id=LKO34glU2MBEVbcOD5mQ&app_code=A2ta_nQ8HRYwenju5HFG5Q",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.data.here.com/p/d/places2/icons/categories/38.icon",
"vicinity": "Pariser Platz<br/>Mitte, 10117 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.ls.hereapi.com/places/v1/places/276u33db-8ee2e0de906e459cbade0593986debe9;context=Zmxvdy1pZD0yOTRmNTU1OC0yZjQyLTVjYWItYmVhZS04YTIzZWJjYTMzODNfMTU4MzI2MzI2MTAzNl8wXzg1NzImcmFuaz0w?app_id=LKO34glU2MBEVbcOD5mQ&app_code=A2ta_nQ8HRYwenju5HFG5Q",
"id": "276u33db-8ee2e0de906e459cbade0593986debe9",
"alternativeNames": [
{
"name": "Brandenburger Tor",
"language": "de"
}
]
},
{
"position": [
52.51373,
13.37976
],
"distance": 279,
"title": "Holocaust Memorial",
"averageRating": 0,
"category": {
"id": "museum",
"title": "Museum",
"href": "https://places.ls.hereapi.com/places/v1/categories/places/museum?app_id=LKO34glU2MBEVbcOD5mQ&app_code=A2ta_nQ8HRYwenju5HFG5Q",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.data.here.com/p/d/places2/icons/categories/10.icon",
"vicinity": "Cora-Berliner-Straße 1<br/>Mitte, 10117 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.ls.hereapi.com/places/v1/places/276u33de-df7d57fd38494a93b2018fe549a0fd75;context=Zmxvdy1pZD0yOTRmNTU1OC0yZjQyLTVjYWItYmVhZS04YTIzZWJjYTMzODNfMTU4MzI2MzI2MTAzNl8wXzg1NzImcmFuaz0x?app_id=LKO34glU2MBEVbcOD5mQ&app_code=A2ta_nQ8HRYwenju5HFG5Q",
"id": "276u33de-df7d57fd38494a93b2018fe549a0fd75",
"openingHours": {
"text": "Tue-Sun: 10:00 - 20:00",
"label": "Opening hours",
"isOpen": false,
"structured": [
{
"start": "T100000",
"duration": "PT10H00M",
"recurrence": "FREQ:DAILY;BYDAY:TU,WE,TH,FR,SA,SU"
}
]
},
"alternativeNames": [
{
"name": "Memorial to the Murdered European Jews",
"language": "en"
},
{
"name": "Memorial to the Murdered Jews of Europe",
"language": "en"
},
{
"name": "Denkmal für die ermordeten Juden Europas",
"language": "de"
}
]
},
{
"position": [
52.51666,
13.40784
],
"distance": 2041,
"title": "Nicholas Quarter",
"averageRating": 0,
"category": {
"id": "museum",
"title": "Museum",
"href": "https://places.ls.hereapi.com/places/v1/categories/places/museum?app_id=LKO34glU2MBEVbcOD5mQ&app_code=A2ta_nQ8HRYwenju5HFG5Q",
"type": "urn:nlp-types:category",
"system": "places"
},
"icon": "https://download.vcdn.data.here.com/p/d/places2/icons/categories/10.icon",
"vicinity": "Nikolaikirchplatz<br/>Mitte, 10178 Berlin",
"having": [],
"type": "urn:nlp-types:place",
"href": "https://places.ls.hereapi.com/places/v1/places/276u33dc-049683d3c6be4bdba823808678a1b164;context=Zmxvdy1pZD0yOTRmNTU1OC0yZjQyLTVjYWItYmVhZS04YTIzZWJjYTMzODNfMTU4MzI2MzI2MTAzNl8wXzg1NzImcmFuaz0xOQ?app_id=LKO34glU2MBEVbcOD5mQ&app_code=A2ta_nQ8HRYwenju5HFG5Q",
"id": "276u33dc-049683d3c6be4bdba823808678a1b164",
"alternativeNames": [
{
"name": "Nikolaiviertel",
"language": "en"
},
{
"name": "Nikolaiviertel",
"language": "de"
}
]
}
]
},
"search": {
"context": {
"location": {
"position": [
52.5159,
13.3777
],
"address": {
"text": "Ebertstraße 22<br/>Mitte, 10117 Berlin<br/>Germany",
"house": "22",
"street": "Ebertstraße",
"postalCode": "10117",
"district": "Mitte",
"city": "Berlin",
"county": "Berlin",
"stateCode": "Berlin",
"country": "Germany",
"countryCode": "DEU"
}
},
"type": "urn:nlp-types:place",
"href": "https://places.ls.hereapi.com/places/v1/places/loc-dmVyc2lvbj0xO3RpdGxlPUViZXJ0c3RyYSVDMyU5RmUrMjI7bGF0PTUyLjUxNTk7bG9uPTEzLjM3Nzc7c3RyZWV0PUViZXJ0c3RyYSVDMyU5RmU7aG91c2U9MjI7Y2l0eT1CZXJsaW47cG9zdGFsQ29kZT0xMDExNztjb3VudHJ5PURFVTtkaXN0cmljdD1NaXR0ZTtzdGF0ZUNvZGU9QmVybGluO2NvdW50eT1CZXJsaW47Y2F0ZWdvcnlJZD1idWlsZGluZztzb3VyY2VTeXN0ZW09aW50ZXJuYWw;context=c2VhcmNoQ29udGV4dD0x?app_id=LKO34glU2MBEVbcOD5mQ&app_code=A2ta_nQ8HRYwenju5HFG5Q"
}
}
}
Does HERE not provide the averageRatings of restaurants or sights-museums?
From the docs it appears if the place hasn't received a rating it'll be 0
Note: If the place has no ratings (yet), both the average and the count values are zero. But if the place cannot be rated (i.e. a street), the whole rating object is not present.
https://developer.here.com/documentation/places/dev_guide/topics/object-rating.html

Resources