How to add time to directions in Bing Maps v7 API? - bing-api

I am trying to work through this example in Bing Maps v7 API:
Create Driving Route Example
What I would like to do is to add a starting time to the example and have each direction have the time you should reach the point. For example 08:00 Start at Airport, 08:15, 32 miles Turn Right, 08:30 64 miles Finish at Hotel.
I have searched through the documentation but cannot find anything like this.
I have noticed that some distances in the directions get assigned times as well as the distance. How is this controlled?
If this isn't possible, can you tell me where I can find the documentation as to how to format each direction and control what is shown?

The Directions module in the Bing Maps V7 control does not have a method to take in a future date time for driving routes. However the Bing Maps REST routing service does support this for driving routes. The REST services are documented here: https://msdn.microsoft.com/en-us/library/ff701713.aspx You will want to use the dateTime parameter. The documentation says that this is require for transit, but doesn't highlight that this is also an option for driving. When set predictive traffic data is used to approximate the travel time. It won't tell you what time you will arrive somewhere, but will tell you how long it would take which you could easily add to your start time. If you want to use this with the JavaScript map control, information on how to use the REST routing service with Bing Maps V7 can be found here: https://msdn.microsoft.com/en-us/library/gg427607.aspx
The Bing Maps V8 map control was just released as a public preview a couple weeks ago. The directions module in there will support the ability to provide future date/times.

Related

Correct recognition results of Google Speech API

Is it possible to train Google Speech API with sample data to help the recognition in my application?
What I mean is an approach like the one provided by wit.ai and described here (even though the example applies to nlp processing). Basically, if you can predict the interactions your users will have with your bot, you can train it to better perform. For instance, I know the subset of cities that will be used, eg: it seems I cannot make the bot understand me when I say Zurich, it becomes Syria or Siberia but I already know that is not possible. So if I, let's say, can upload a list of preferred words to be used first and then if no match is found there fallback to standard recognition or some similar approach I think it will be achieve better results.
Any idea if it is possible and how? I know those APIs are in beta stage and subject to change, but I would still like to give it a try.
I can upload some code sample of what I am currently doing, though it is just sending an audio and analyzing the result so far, so not really close to this problem.
In recognition config you can specify alternatives to return you with maxAlternatives field (up to 30). Once you have 30 alternatives with confidence you'll have Syria with confidence 0.5, Siberia with confidence 0.01 and Zurich with confidence 0.1. Usually the proper answer is present, although it might not be on the top. You can select best alternative according to your current status.
The current Google Cloud Speech-to-Text API allows the user to specify a list of words and phrases that provide hints to the speech recognition task.
From https://cloud.google.com/speech-to-text/docs/basics (mirror):
speechContext - (optional) contains additional contextual information for processing this audio. A context contains the following sub-field:
phrases - contains a list of words and phrases that provide hints to the speech recognition task.
For more details, see: https://cloud.google.com/speech-to-text/docs/basics#phrase-hints (mirror).

Get all postcodes on a given location using any Google API

Is it possible to get all postal codes in a given location inside the given radius?
What Google API should I use?
Example: I have a lat. and a long. and my radius is 15kms. How do I get the post codes of the areas inside the radius?
I'm kinda new to using API's and Google API's.
Thanks!
This is a process called "Reverse Geocoding" Google offers it here - https://developers.google.com/maps/documentation/javascript/examples/geocoding-reverse
However pretty sure that Google's API will try to give you one closest result rather than many.
You can do this with APIs (often paid for) however, be warned that you have to be quite careful with the radius element, setting it too small in rural areas will bring back 0 results and setting it too big in urban areas will bring back potentially thousands.

Best/fastest way to find current user location on Windows Phone App

I am trying to figure out what is the fastest way the figure out the current user Country. I know there are a lot of location examples online, my actual is question: since I don't care much about precision, is it OK if I use RegionInfo.CurrentRegion.DisplayName; to figure out the user country?
What are the downsides of using this approach (besides precision)?
No, you shouldn't use RegionInfo.CurrentRegion for that.
For example, I live in Montenegro, but RegionInfo.CurrentRegion on my phone will return USA, which is completely irrelevant being almost 4000 miles away from here.
You have to use Geolocator class for that. Here's some sample code.

Not your typical Mapping App

I'm in the concept development stage of an iOS app that is essentially a game. One of the things I want to do is to get information about the current location. I've not used the map kit so far, and after a quick read through various documentation, it looks like it is designed mainly as a display kit. What I'd like to do in addition to displaying a map is to query data that might be at the location. For example, if I provide latitude and longitude, I want to know whether that location represents land or water. If it's on land, how close is it to the nearest street? If it's not near a street, what other information might there be about the spot?
I realize there are vast amounts of data available that are geocoded, but is there any information that can be queried directly from the map kit? I would have thought things like elevation would be easily available, but I haven't seen anything like that yet. Am I just looking in the wrong place?
As far as I am aware there is no data that you can query directly from MapKit - i.e. you cannot ask MapKit if a location is on land or water.
You could use reverse geo-coding with the current longitude/latitude to find out details about the location, for example nearest street/town, or which country the location is in.
Check out the built in Apple Geocoding framework, or the Google Geocoding API
Hope this helps.

Best GUI control(s) to describe a time range

I need to let end users specify a time range, to be stored and used internally as a starting date/time and ending date/time. The range could be minutes or it could be days.
Has anyone discovered an interactive control that can handle this elegantly?
Most GUI toolkits have a calendar control, so I could specify "start" with a calendar for the day and a text field for the time...and the same for "end".
I could also replace the "end" controls with a single text field or slider that simply describes how many seconds/minutes/hours after start "end" is.
What I don't like about these ideas is how much clicking, typing, and more clicking is required to describe such a simple concept. Also I have to slap the user's hand if a time is typed in that isn't recognizable as a time.
Is there a cleaner implementation that I'm overlooking?
I tend to look at common design patterns for inspiration when I'm pondering problems such as this.
The Yahoo Pattern Library offers some potential solutions.
The UI Patterns site also give some suggestions, and is worth a browse.
For good measure, here's another solution at the Welie pattern library.
Another source of inspiration might be other sites and applications. For example, think of all the use-cases where recording short and long time time durations is required. As an example, company TimeSheet recording, company car mileage log software, task recording software, stopwatch applications, calendaring apps, etc. Then see how they've handled the GUI controls for capturing time ranges.
I haven't personally found a favourite solution for picking date and time. But, I think I'd want something like this.
User clicks to show calendar popup
Popup shows 2 side-by-side calendars (start date/time and end date/time)
Calendar 1 shows todays date, and the other also shows todays date.
Calendar controls allow usual navigation and selection of day month year.
Below each calendar is a hh:mm box, which defaults to the current time.
User can edit value in this time box using up/down arrows or by typing.
Alternatively, show an analogue clock below each calendar. It takes 2 mouse clicks to set time( click 1 for hour and click 2 for minutes).
Hope this helps
I am a fan of an old control I saw used WAY back in the 90's with Inventor (and later Open Inventor) on SGI machines (and then on PCs, etc): an infinite dial.
Some screenshots, a little on the small side, are here. Course, its been done on a variety of platforms since, including similar things on the iphone.
I think a date/time picker would work well with two dials, each representing an order of date/time magnitude. In ASCII art, with each dial between [square brackets] it might look like:
[20 Oct | 21 OCT | 22 Oct ] [11:15 .. 11:30 .. 11:45..]
or with 3:
[20 Oct | 21 OCT | 22 Oct ] [11 .. 12 .. 1pm] [12:31 .. 12:32 .. 12:33]
There are a number of variations you could try (vertical/horizontal, date/time, date/hour/minute, etc).
Dials, though somewhat rarely used, are a natural device for humans to interact with, and their infinite rotation option (unlike a slide which must always stop) suits dates/times well.
FWIW
User interface design is heavily application dependent. "Best" implies some kind of metric that can measure solutions. In UI design such a metric can be "home many clicks/key-presses does it take to complete the task?" where a smaller number is better. So once you've defined your metric you can start to sort solutions into good, better and best.
You also want to reduce cognitive burden for the user. If the user has to enter the final day on which a product can be exchanged based on a 90-day return policy then asking for start and end date would force them to do date math which is no fun. In this example a start date with a "delta" of x days would place less of a burden on the user.
Depending on you application you could consider and approach like the Google Finance time range selector on their charts: http://finance.google.com/finance?q=.dji
There is no single answer, it depends on the context. For many places good text controls are enough. Of course such things can still help by supporting pasting and some increase/decrease actions. Maybe it can even do some validation for the value.
Then there are places that need something more. Calendar can be really helpful for entering dates and some kind of slider could be used for time. (Lotus Notes calendar has a slider.)
My advise is:
Think what you need. Don't put complicated widgets to a less used dialog.
If you need these nice helpful widgets, check if there are ready made in the library you are using and take some time to see how others have done these.
Always have the text controls with support for pasting.
Check out the VisualHint date control. It can be configured a multitude of ways including a timespan. This would allow you to use one control instance to show the start time and another to set the timespan until the period is complete. The control also supports an extensible base framework so you could possibly combine both start/end or start/span into a single control.
Here are also some solutions: http://quince.infragistics.com/html/PatternView.aspx?name=Date+Time+Range+Input
Unless there is a more advanced time control in your GUI toolkit of choice, two calendar controls representing start and end is the most straightforward. Also, you need to decide how you want to use the information. For example, if you used a start date and an interval to increment that date, changing the start date wouldn't change the meaning of the interval. It really depends on what you're wanting to do.
One way I've seen work very well is using a gantt chart:
http://en.wikipedia.org/wiki/Gantt_chart
You can create a single line chart and then you can scale it across months, days, hours and minutes depending on how wide or zoomed in you make the control. The problem is I don't know of any control out there right now that does just one line, so you may need to create a custom one. You could possibly look for a gantt chart control and just do one task/item.
Observe what people are doing with your time range control. Then write it so that it's most suited towards doing what the people want to achieve with it. For instance, leave away past dates if inputting future dates only makes sense.
Jonathan Leighton has made a nice date inputter -element in jquery that I've found very nice for inputting dates. This is beneficial in a way that user can both input the date by clicking or type it in directly. The user also directly gets the hint about typing it into the box. If you couple this with some kind of timeline -object, you may actually go far afar. Just avoid making UI elements that are confusing or angering!
This comes in late, and it's not a control per se. I read this idea on a blog I can't find anymore (in fact, I found this post while trying to find it). The idea is to use the metaphor of a wall clock. Here's what I implemented for the fun of it. It's not a functional control. You could use something like this as a starting point for capturing times naturally. Three clicks at most, two most of the time. Only dials come close.
http://www.viridium.ro/clock-sample/
Use a HTML5-aware browser; that is, Chrome.

Resources