I am making an application where one person can watch all the other users of the app driving on the streets. I am using google maps and I am animating markers on the map, as the location of the users is changed in real time using socket.io.
The problem is that most of the phones have not so accurate gps, and the pins are moved all across the map, not only on the streets, the sometimes jump on the grass, water, they are rotated in the wrong direction, etc... Is it somehow possible to move the markers on the street only?
I guess this can be done using google's direction API. You can request google direction api for the point you have to another point on the road. Google's response first point can be taken as on the nearest road point. I had look on the similar solutions people done on the web.
Have a look on this.
Related
I'm developing an Android application (in Java/Android Studio) which receives Latitude/Longitude coordinates from a network source, which it has to plot on the screen. The appearance should be much like one of those old 'green-on-black radar screens'.
Constraints/Requirements:
The application doesn't have connection to the internet. (never)
I need to draw points, (custom) markers, lines, and polygons, all based on latitude/longitude information.
The background should be plain black. i.e. no map tiles or anything.
Does anyone know of a library which can help me achieve this?
Other options I'm considering:
Manual direct conversion to screen X/Y coordinates. This seems problematic (?) as you get closer to the poles.
Converting all points to polar coordinates (bearing/distance) from a center position. And then convert these polar coordinates to screen X/Y coordinates. Should work for the radar-style application, but seems cumbersome when there's a good library available.
I'm really interested in what you guys think and if you have suggestions on how to address this.
Thanks a million!
Kind regards,
Joost
Background:
I am currently developing a Web-Based 3D multi-player motion sensor console game (Air Table Tennis). Mobile is acting as a racket for game, Sensor data (gyroscope,accelerator,rotation-vectors) is used rotate racket. Mobile transmit sensor data to game engine(BabylonJS,NodeJS,SocketIO) where on real time I map those values.
Problem:
I want when user(holding mobile) moves in any direction my racket on game
screen will also move in that particular direction.
For this i have studied azimuth values,velocity-graphs and Google Project Tango(Tango is using Computer Vision which in my case can not be implemented) but I am not getting anywhere. If someone suggests me anything it'll be highly appreciated!
You may want to look at this section here: https://developer.android.com/guide/topics/sensors/sensors_overview.html#sensors-coords
Just keep in mind that not all devices have gyroscopes or magnetometers, so getting phone positions relative to the earth would be impossible on such devices.
I'm doing an Android app which has a Google map in it. The main function of the app is to return a route between two locations, traveled by bus. However, the polyline returned by google direction api service for bus are just straight lines between bus stops, is there any way I can get the actual bus travelling routes? I have read stuffs and the only solution I found is to draw polyline snap to road, but it is not guaranteed that the bus actually travel using that road.
For example, if I request for a bus route between London Kings Cross station and London Waterloo station, and let's say this is my direction request URL:
maps.googleapis.com/maps/api/directions/json?origin=LondonKingsCross&destination=LondonWaterloo&mode=transit&transit_mode=bus&key=MY_API_KEY
Then I use the JSON result to draw my polyline, it would look something like this:
Zoomed in section of a polyline between two bus stops
However, the bus might actually travel like this:
Actual bus route
How/Where can I get the actual polyline(list of latlng points) that allows me to draw on my map?
Try the below link. Worked for me.
Draw Path using Json Response
I want to make an Android App, with a real map and a overlay for the map, where sprites are drawn (can be dots or small images).
This is a rather hard question, so I have made a sketch of a map of a small city, where only roads and streets can be seen. That might look something like this on the device:
Imagine the red dots to be bots, and they want to get to the yellow dot, assuming they know the position.
What Android Map API should I use to be able to:
Draw custom sprites on a given location on the map (geo-coordinates rather than screen coordinates).
Generate valid paths from the streets and roads on the map, which the dots can move on (black lines).
Use pathfinding to calculate the shortest routes, e.g. from red dot to yellow dot.
Must be able to draw more than 10 sprites on the map.
(the map doesn't have to support 3d views or street views. Plain old top-down view is just fine)
If no map API exists that does not meet these requirements, what are some other solutions?
I'm really excited about this project, but I'm having a lot of trouble getting started with it, so any help or guidance will be much appreciated.
EDIT:
It seems that there is no answer to my question. I will leave this open and report back with my own solution.
Google Maps Android API v2 and Marker class.
All valid paths? You probably should not need it if you use Android API v2 with real map drawn for you, but you can also try to use Google Directions API.
Google Directions API.
No API exist that can handle more than 10 objects. You probably need something from NASA.
Have fun coding.
It's going to be a very generic question.
By the way, I am trying to replicate this :
I created a web page that displays the lat/long information for whoever. It refreshes itself every X second.
I open my android, navigate to my web page, put the phone somewhere in the car and start driving. The idea is to capture my entry/exit lines to see how good/bad my approach to an apex is.
I guess I need to understand how typical in car navigation systems work. They track you to the point. Any ideas?
I don't think GPS is going to be accurate enough for this.
Assuming you have a good fix on 5 or 6 satellites, your coordinates are typically going to be 15-30ft from your actual position. This is barely enough to determine which side of the road you're on, and probably won't help you.
Car navigation systems fake it to make it seem that they are far more accurate. They use information such as your current position, heading, and the road data it has to plot more precisely your location.
You can prove this easily. Take a car GPS system, and start walking away from the road. You will have to get a decent distance away from the road before it shows you aren't on it anymore. That is because the software is trying to compensate for the inaccuracy of the coordinates coming from the GPS.