Bing Truck Routing API - travelDistance units - bing-maps

We're dipping our toes into the Truck Routing API, and have a question on the units used in the travelDistance element of the regionTravelSummary.
Example GET request
https://dev.virtualearth.net/REST/v1/Routes/Truck?wayPoint.1=85710&waypoint.2=80634&routeAttributes=regionTravelSummary&distanceUnit=mi&vehicleTrailers=1&key=
What's interesting is in the routeLegs.RegionTravelSummary, the travelDistance is not in Miles (or kilometers, or anything I can figure out). Here's a snippet of the JSON:
"regionTravelSummary":[
{
"name":"United States",
"subregions":[
{
"name":"Arizona",
"travelDistance":818486183.9,
"travelDuration":22151,
"travelDurationTraffic":22151
},
{
"name":"New Mexico",
"travelDistance":1019336643.92,
"travelDuration":19460,
"travelDurationTraffic":19460
},
{
"name":"Colorado",
"tollDistance":11959005.54,
"travelDistance":702204931.54,
"travelDuration":14428,
"travelDurationTraffic":14428
}
],
"tollDistance":11959005.54,
"travelDistance":2540027759.36,
"travelDuration":56038,
"travelDurationTraffic":56038
}
]
What am I looking at here? The travelDistance in the primary resources array is correctly showing 980 miles:
"trafficCongestion":"None",
"trafficDataUsed":"None",
"travelDistance":980.715076,
"travelDuration":56038,
"travelDurationTraffic":57776,
"travelMode":"Truck"
For this route, there should be 130 miles in Arizona, and 550 miles in New Mexico, and 300 for Colorado (+/- 40ish miles here or there depending on engine and settings).

Haven't seen that before. I've sent this thread to the engineering team to investigate. I also can't figure out for the life of me what those units are. Will update this post with any updates I hear.
Update
That team recently noticed this issue as well and are investigating a fix. They plan to have this fixed in production by end of next week.
Update 2
The Bing Maps team also asks that you direct technical support related questions to the Microsoft Q&A forums. The StackOverflow community often closes this type of questions as it's not meant to be a support channel. Here is the main technical forum for Microsoft enterprise mapping products: https://learn.microsoft.com/en-us/answers/topics/azure-maps.html

Related

FleetApi - How to use legal rest times?

I'd like to know the position in which the driver would need to rest with given waypoints.
I am calling GET https://fleet.ls.hereapi.com/2/calculateroute.json with the following params:
{
mode: "fastest;car;traffic:enabled",
waypoint0: "19.286769, -99.652773",
waypoint1: "19.419185, -99.17755430000001",
waypoint2: "19.41530,-99.17844",
waypoint3: "31.29778, -110.93690",
restTimes: "MEX",
maxSpeed: 110,
departure: "2021-07-20T15:00:00.000Z"
}
This returns warnings with the info of rest times like this:
{
"message": "Taking the short driver rest time after 18036 sec for 1800 sec at routeLinkSeqNum 1485",
"code": 14,
"routeLinkSeqNum": 1485
}
I would like to know how to use/read this info. I don't know what routeLinkSeqNum is and how to utilize it.
Governments impose rules on how long a truck driver can drive before he needs to rest. Routing can consider these regulations w.r.t. short rests during a day and long (overnight) rests.
For example, in EU countries drivers have to rest after 4.5 hours of driving for at least 45 minutes, and must not exceed a total of 9 working hours per day before they have to rest for 11 hours.
Activate this feature in the router using the "&restTimes=local", in this case, it is the "MEX" in the request parameter. Routing will then consider each country's local regulations.
In the same parameter, you can specify whether the driver starts the route freshly or how long he is already driving / on duty since his last short or long rest period
routeLinkSeqNum is an index of the link array within a Leg. If you check the response, there will be response>route>[0]>leg[0]>[2]>link[1485].
So one route can have n-legs, 1 leg can have m-links
This will help you to plot the rest times.
Here is an example shown in the tool:
https://tcs.ext.here.com/examples/v3/fleet_telematics_api

How to get heading accuracy of mobile devices?

I offer a service which needs the correct location and heading of the mobile device the user is accessing my service with. It was relatively easy to get the information but now I am stuck at finding out how accurate the heading I received is.
Since I'm not using any framework for this or develop in Android/iOS, where there are solutions for that problem, I'd need a solution only depending on javascript (+ 3rd party libraries).
I've found the Generic Sensor API from W3C but couldn't find any sensor which hold that information. Neither the Accelerometer-, nor the AbsoluteOrientationSensor held the needed information.
My current code looks like that..
let accelerometer = null;
try {
accelerometer = new Accelerometer({ frequency: 60 });
accelerometer.addEventListener('error', event => {
// Handle runtime errors.
if (event.error.name === 'NotAllowedError') {
console.log('Permission to access sensor was denied.');
} else if (event.error.name === 'NotReadableError') {
console.log('Cannot connect to the sensor.');
}
});
accelerometer.addEventListener('reading', (event) => {
console.log(accelerometer);
console.log(event);
});
accelerometer.start();
.. but since the problem if more of a 'finding the right tool to do the job'-type, it won't help much in better depicting my problems. Further, Google uses kind of the same functionality I'm aiming for in Google Maps, so theoretically there must be a way to get the heading accuracy.
So, in conclusion, is there any way to retrieve the heading accuracy in a simple javascript environment?
Thanks!

Facebook API retrieving Facebook Event HostedBY

So, I'm building an app for my company that sources several different API's from different sites to grab Events from Hotels in the area.
I've got this working for Facebook..... but I'm trying to figure out how to access the "Hosted by" field associated with an event.
https://graph.facebook.com/v2.10/[EventID]?access_token=[Accesstoken] gives me all of the event information I need... except the "Hosted By" personID.
Anyone familiar with this? When I view the source of an event page, I can find the URL to the Hosted by Webpage, but I cannot find the link anywhere. I've searched every forum, and read the Facebook API documentation and just seem to be missing this.
I assume that is effectively the Admin field and Owners connection, but this is making some assumptions from https://developers.facebook.com/docs/graph-api/reference/event/
https://www.facebook.com/events/1018032181661092
$ oksocial https://graph.facebook.com/1018032181661092/admins
{
"data": [
{
"id": "796783270463511",
"name": "London Events, Concerts & Parties"
},
{
"id": "564808213723724",
"name": "Best Places in the UK"
}
],
"paging": {
"cursors": {
"before": "Nzk2NzgzMjcwNDYzNTEx",
"after": "NTY0ODA4MjEzNzIzNzI0"
}
}
}
$ oksocial https://graph.facebook.com/1018032181661092?fields=name,description,parent_group,owner
{
"name": "Winter Wonderland 2017",
"description": "Winter Wonderland, Hyde Park in London from 17 november!\n\nEvery year this massive Christmas event takes place in Hyde Park. Each year it is bigger with more rides etc.\n\nHyde Park Winter Wonderland is a spectacular festive event in the heart of the capital. For six weeks, London’s famous Hyde Park is transformed into a magical wonderland of winter festivities.\nIt’s FREE to enter so you can walk around at your leisure and soak up the atmosphere.\n\nWinter Wonderland offers a dazzling array of activities and entertainment. Enjoy skating around the UK’s largest open-air ice rink, have an arctic adventure in the Magical Ice Kingdom, see jaw-dropping circus shows, world-class ice dancing in The Nutcracker on Ice and see stunning views across London in the Giant Observation Wheel. There’s over 100 spectacular festive rides and attractions, London’s largest German-style Christmas Markets, plus a wealth of delicious food and mulled wine aplenty!\n\n► The entrance to Winter Wonderland is FREE\n\nTickets for Winter Wonderland attractions:\n► http://hydeparkwinterwonderland.com/\n\n Find things you could do in London: \n► http://tidd.ly/a4bdd6cb\n\nBook here your stay in London:\n► http://tidd.ly/d20e50cb\n\nCinderella on Ice Tickets:\n► http://tidd.ly/fb287a8c\n\nAll London event highlights:\n► www.facebook.com/london.events.concerts/",
"owner": {
"name": "Best Places in the UK",
"id": "564808213723724"
},
"id": "1018032181661092"
}

Bing Maps search defaults to Lancaster

I don't know if anyone have noticed this, when requesting from Bing maps REST service for some locations, or if the query was not well formed, the response from Bing maps gives the coordinates of Lancaster, Lancashire, as if it was defaulting to this location...
try this request and check the coordinates, it should yield the coordinates of "Bethnal Green, London - East", instead it is "Lancaster, Lancashire":
http://dev.virtualearth.net/REST/v1/Locations?locality=Bethnal+Green+&adminDistrict=%22London+-+East%22&countryRegion=UK&o=xml&key=BING_MAPS_KEY
Any info about this and how to stop it is appreciated.
What is happening is that the geocoder isn't understanding your lower level address information so it moves up through the address until it finds something. In this case it is returning a coordinate for the center of the UK. This just happens to be near Lancaster, Lancashire. If you look at the Name or address property of the result you will be able to see this pretty clearly. Also, since you are working with the REST services take a look at these tips and tricks: http://www.bing.com/blogs/site_blogs/b/maps/archive/2013/02/14/bing-maps-rest-service-tips-amp-tricks.aspx

Is there any audio ads for iPhone audio apps?

my app is like podcast for web articles. https://apps.apple.com/app/id1273954643
I plan to make a free version and am curious if there is audio ads for iPhone apps.
Since most users of my app don't see the screen, banner ads doesn't fit well.
I want to insert audio ads like spotify.
I checked http://www.medialets.com/ and http://www.greystripe.com/, but their show cases
are quite vague. I sent emails to them, but no reply yet.
Any help will be greatly appreciated.
Thanks!
Hmmm... this seems like an awesome business opportunity that hasn't been properly executed yet.
I have also seen mentions of audio ads being served up into client iPhone apps by TargetSpot.
I really like your idea.And after searching for a while i came across this helpful tutorial-
Though its kind of commercial but hope it will help you.
http://advertising.about.com/od/smallbusinesscampaigns/a/podcastweb.htm
if you're willing to use an API. You could use something like this
https://docs.api.audio/recipes/programmatic-audio-ads
#Check that you are using python 3.8 or further
#pip install -U aflr
import aflr
aflr.api_key = "APIKEY"
audience = [
{"number": "33", "location": "Buckingham"},
{"number": "22", "location": "Sunshine"},
]
text = """
<<soundSegment::effect1>>
<<sectionName::hello>>
If you have any plans for today, cancel them!
<<soundSegment::intro>>
<<sectionName::hello2>>
This really is the final call for {{location}} Hyundai's massive clear out sale! Only until midnight tonight, so come on down!
<<soundSegment::main>>
<<sectionName::main>>
We're clearing out all remaining 2020 Hyundais at Ottawa's top volume Hyundai dealers. These are the last days for clear out pricing and amazing clear out incentives. Zero percent financing for up to 84 months, and up to 7700 in cash price adjustments on all 2020 Hyundais at Hyundai on {{location}}. Pick one of the {{number}} Santa Fays in stock, a family-sized SUV with all-wheel drive and back-up cameras from just $85 weekly, zero down!
It's the easiest time to get into a new Hyundai, but these deals won't be around for long, ONLY until midnight TONIGHT!
<<soundSegment::outro>>
<<sectionName::outro>>
Get into a new Hyundai today. At {{location}} Hyundai, better cars for passionate car drivers. <break time="1s"/>
"""
script = aflr.Script().create(scriptText=text, scriptName="helloworld", moduleName="hello", projectName="hello")
print(script)
for item in audience:
r = aflr.Speech().create(
scriptId=script.get("scriptId"),
voice="en-US-GuyNeural",
speed=120,
silence_padding=0,
audience=[item],
)
print(r)
template = "hotwheels"
print(template)
for item in audience:
r = aflr.Mastering().create(
scriptId=script.get("scriptId"), soundTemplate=template, audience=[item]
)
print(r)
url = aflr.Mastering().download(
scriptId=script.get("scriptId"),
parameters=item,
destination=".",
)
print(f"✨ Mastered file for template {template} ✨")
print(url)
```
That way you could serve this, this is in python. You could also do it in Swift (but there's no sdk for this atm you'd need to write it yourself).
Disclamier - I work for www.api.audio