Im currently working with google maps on my android app and i need to compare distances when the camera is moved. I can get the current camera latitude and longitude by using the onCameraChange method, however, im struggling with getting the cameras previous latitude and longitude. Any suggestions would be great.
I do not see an existing API to get previous location with Google Maps Camera position api
You can create a prevLat, and prevLong variables. The first time your app starts, in initialization, save the location in these variables. Use these to calculate the distance in onCameraChange, and then update the prevLat, prevLang with current location at the end of onCameraChange.
Related
hi guys im using the fused location provider to get the location of users and then i display a marker on their location . the problem is that the marker keeps moving even if my phone is not moving . the accuracy is set to HIGH_ACCURACY .
I want to get the distance that the device moved between the start location and the end location. I'm getting the speed and the time user spent on the journey using GPSManager and GPSCallback.
Is there any way to get the accurate distance between start and end locations?
Here user doesn't know what the end location is. It is the location where the user stops the journey.
If you have latitude and longitude values of both start and end locations (I assume you have got), this answer which I have used before works well.
I was making a health based android app where when user presses a button, google maps get displayed on the screen along with locations of all hospitals within a kilometer radius marked.
I have used google places API to return JSON data of all hospitals within 1km but I don't know how to implement this.
Please do help me out.
It sounds like what you want to do is put markers on the map to represent the location of each hospital. You do this like so:
mMap.addMarker(new MarkerOptions()
.title(placeName)
.position(new LatLng(lat, lng));
Here, mMap is the Google Map and placeName, lat andlng` are the hospital details you've extracted from the JSON returned from the Places API.
More detail available in the online docs.
I'm trying to create a vaadin project where the user would enter the latitude and longitude and then maybe press a button so it would find that exact location in google maps. How would I connect that to happen?
You can use the leaflet addon for vaadin. You would then create a LMarker object with the longitude and latiude and add it to the map.
I am developing a software, some kind of GPS. It has two sides. Admin(PC) and Clients(Android).
Android version use Osmdroid maps, and what I want to do is grab the Mappoint that I created in Android, insert it to the database and than read it from other devices.
The problem is that if the actual Latitude and Longitude of point that I create is for example 42.222222 and 23.55555, after doing this:
IProjection project = view.getProjection();
final GeoPoint geo = (GeoPoint)project.fromPixels((int)e.getX(),(int)e.getY());
*e is a motion event
the actual value that is stored in latitude and longitude of that GeoPoint is 42222222 or 2355555. The coma just disappears from that values, so it is useless to usage in PC version. I don't know how the OSMdroid is working with this values, but is there any way to convert it to its standard format like -42.584254 ?
I´ve just found a solution ,it must be just divided by 1E6 :)