Create a card with realtime distance to coordinates - google-mirror-api

I understand that I can a render maps on timeline cards. Can I create a card with a set of coordinates that display live updates with the distance to those coordinates?
No map is displayed, just a number (meters, feet) that is updated as the user moves.

From what I can tell that is not possible at the moment.
All you can do with the locations queries are gets and lists. From what I understand it updates every ten minutes as you can read at: https://developers.google.com/glass/location

Yes, you can create a card that contains this information, but it requires that you use some other APIs in addition to the Mirror API. The Google Distance Matrix API appears to be a good fit for this use case.
Every time you'd like to update the timeline card, make a request to the Distance Matrix API to determine the travel distance across that set of coordinates. Convert this into a human readable format, and include it into the timelineItem.text or timelineItem.html field for the card.

Related

Recharts graph doesnt render correct

I am currently working on an component that fetch data from 2 different end points. First end point delivers multiple data measured by sensors and a timestamp. The second endpoint offers predicted values for sensor data and timestamp also. After i fetch the data i combine the fetched data and try to create a chart based on combined data, having diferent lines for every measured or predicted parameters. For chart I,m using Rechart library. When i first load the page with the graphics, the graph displays all the data as i intended, but after a second or two, the chart is losing some of the values and "shrinks".
Another mention is that the requests for data are made for a range of days and im using a datetimepicker for choosing the range. After the graph loads, if i change the range the new set of data is displayed correctly so the problem occurs only on the first render i think.
Does anyone had a problem like this? Or what can be the cause of it?

Non Redundant Image Extraction From Video

I am collecting data for a project. The data collection is done by recording videos of the subjects and the environment. However, while training the network, I would not want to train it with all the images collected in the video sequence.
The main objective is to not train the network with redundant images. The video sequence collected at 30 frames/sec can have redundant images (images that are very similar) within the short intervals. T(th) frame and (T+1)th frame can be similar.
Can someone suggest ways to extract only the images that can be useful for training ?
Update #2: Further resources,
https://github.com/JohannesBuchner/imagehash
https://www.pyimagesearch.com/2017/11/27/image-hashing-opencv-python/
https://www.pyimagesearch.com/2020/04/20/detect-and-remove-duplicate-images-from-a-dataset-for-deep-learning/
Update #1: You can use this repo to calculate similarity between given images. https://github.com/quickgrid/image-similarity**
If frames with certain objects(e.g., vehicle, device) are important, then use pretrained object detectors if available, to extract important frames.
Next, use a similarity method to remove similar images in nearby frames. Until a chosen threshold is exceeded keep removing nearby N frames.
This link should be helpful in finding right method for your case,
https://datascience.stackexchange.com/questions/48642/how-to-measure-the-similarity-between-two-images
This repository below should help implement the idea with few lines of code. It uses CNN to extract features then calculates there cosine distance as mentioned there.
https://github.com/ryanfwy/image-similarity

How to calculate distance between two zip code from bing map service

I want to calculate distance between two zip code by bing map API. Is there any possible way to do this I tried this link but this is not for two zip code. Is there any way to do this.
I Pass ZIP1- 34481 and ZIP2- 34705 and want result 70.9 in miles
i calculate this direct from bing map. Thanks for your response
From reading the article, the example as stands will give you a GEOGRAPHY point object (although not sure if your inputs are valid, it seems it require a street address). Anyway, call it twice then to determine the distance between the points returned use something like
Point1.STDistance(Point2)
Here's the BOL reference https://msdn.microsoft.com/en-us/library/bb933808.aspx
Alternatively, see this question for a Bing Routes API answer. How to calculate the driving distance between two points?
If you still need to geocode the approx centre of a zipcode, you might be better off importing the data yourself. I did this recently for the Australian GNAF data (https://www.rednotebluenote.com/2016/04/importing-psma-geocoded-national-address-file-g-naf-to-sql-server/ ) which you might find useful background reading. For US I believe http://census.gov/ makes something similar available.
Hope this is of use.

What's the best way to limit the messages in an AngularJS Chatroom

Ok, so here's the setup:
Building a Realtime AngularJS chat application. However, I want to limit the messages the user sees by an API call that determines other messages within their proximity.
For some reason, I can't wrap my head around this. I've explored socket.io, FireBase, PubNub, and I can't seem to come up with a good way to limit the data that comes back from these services based on an API call that sets parameters.
Thoughts?
Geohashing Chat by Proximity
Try it now: Geohash Chat by Proximity
To connect groups of two or more people by location, you will take lat/long values and reduce the resolution of accuracy, and by doing this you can expand the coverage of proximity. You can use multiple resolutions at once or a fixed resolution.
Get Source Code: GitHub Repository for Geo Chat by Proximity
Basics of Geo Hashing
Next we'll cover some source code snippet for geo hashing lat/long coords. It is fairly simple to increase the radius of lat/long position by reducing the accuracy of the float values. Using this you can expand the circle and collect a Lat/Long.
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Geo Hash
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
function geohash( coord, resolution ) {
var rez = Math.pow( 10, resolution || 0 );
return Math.floor(coord * rez) / rez;
}
Geo Hashing Resolution "Zoom"
"Zoom" levels, basically several different cartesian grids with larger and smaller granularity. Once a Geofencing event fires, you will publish to a set of channels corresponding with each zoom level. Zoom levels are important as that is how we actually construct the link between Geofencing and PubNub. Zoom level is the resolution/de-resolution of the Cartesian coordinates Lat/Long (think X,Y coord). By reducing the resolution of the lat/long coord we can construct a channel name that hits 1 box of the grid. Less resolution means larger the boxes and is required to determine a PubNub Channel that is associated.
// Create Proximity Channel
channel = geohash( pos.latitude, 0 ) + '' + geohash( pos.longitude, 0 );
This will create a very wide circle and generate a channel name used to connect. Next connect to PubNub with this channel name.
// Connect to Proximity Channel
pubnub.subscribe({
channel : channel,
message : receive,
connect : ready,
presence : presence
});
Multiplexing 9 Boxes
You will calculate the surrounding squares to extend the taper and radius in a way that provides more accuracy. This will remove the "fencing" effect.
Geo Hashing with PubNub Conclusion
That's it! You simply reduce the resolution of a geo coordinate and use that as a channel name on PubNub. Also check out the browser's navigator.geolocation.getCurrentPosition(...) method to acquire lat/long in a chrome/firefox/ie/opera/mobile/safari browser.
Also checkout the PubNub Connected Car Solution Kit

How can I store a video with proper indexing

How can I store a video (either in database or file system) so that instead of starting streaming from starting I can start this streaming from any fix index.
Main aim is like I have a large video of roads of New York from one end to other and corresponding map of New York save on a central server. Now a user opens up the website and selects the two points on the map of New York and video of road between those two points starts streaming, not from starting but from first point to second point given by user.
So main requirement is to store a video with its indexes such that I can start streaming from any of the index.
Edited Part :
Actually I am planning how to store video of complete city so I can show it to user whenever he selects it on map.
So Now Main question in my mind is can I merge video for all roads in one video like various linked lists (Roads). Like if there are two turns at particular point then instead of storing two videos from that point for different path can I store them in a single video such that which video you have to play will depend upon starting and ending point selected by user and shortest path between those two points, But can I store video of all roads as a single video.
How can I do this, will it depend on stream mechanism or on storage ?
Thanks,
GG
I guess that this all depends on the capability of your playing/streaming mechanism. I would find out about these before determining how to store the file and/or "index" points. Ask some specific questions about your streaming technology, such as:
can you fast forward to a certain point?
can you stop at a certain point?
can you play one stream after one ends?
another play capabilities that may help solve this?
If you can trigger the playing of your video to fast forward to a certain point, you can store the amount of time or frames to fast forward from the beginning and associate these with your map start. You would also need to "abort" the stream at a certain point, that matches your map end point.
However, if you can not fast forward your stream, you many need to break your video file into smaller segments and start at the proper one based on the map point selected. You would then need to play multiple files until you reach the end point.

Resources