distance

Android: distanceTo() wrong values

只愿长相守 提交于 2019-12-13 03:05:54
问题 I am writing an application for tracking my route. I am requesting updates from GPS every minute and it works fine. It shows me my exact point. When I want to calculate distance between current point and previous one it works ok, but form time to time it calculates distance totaly wrong (I moved about 200m and it retuned me a value over 10km). Does anyone know why this could happen? Here is the function which I use: iRoute += myGPSLocation.distanceTo(prevLocation); Thanks in advance! 回答1:

Android Find All locations within a given distance

杀马特。学长 韩版系。学妹 提交于 2019-12-13 02:54:49
问题 I have to make an Android 2.2 application that requires to find all location within a given distance. I have the longitude and latitude for all locations I use in my app, but for example if I want to find only the locations within 5 km how could I do that? I use SQLite so I cannot use functions like cos,sin etc.. I have spent all day long searching for an answer so I would be very grateful if you could help me. Thanks 来源: https://stackoverflow.com/questions/9791074/android-find-all-locations

Measure distance walked with GeoPoint and displaying distance to user

廉价感情. 提交于 2019-12-13 01:28:49
问题 In my app I am trying to make it possible to calculate the distance a person walks. To do this I have created a LocationHelper class that should get me the current GeoPoint every 30 seconds or 10 meters. I already have a method that returns the distance in meters between two GeoPoints that I know works, because I have used it in a previous project. I also have an Activity called WalkActivity where I call the method getDistance() in LocationHelper and display it in a TextView that is updated

distance between two locations is not right?

橙三吉。 提交于 2019-12-13 01:26:28
问题 i get two locations using this : LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE); then i compute the distance between them , but the distance is not true public static float calculateDistance(double e, double f, double g, double h) { float dLat = (float) Math.toRadians(g - e); float dLon = (float) Math.toRadians(h - f); float a = (float) (Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(Math.toRadians(e)) * Math.cos(Math.toRadians(g)) *

distance and travel time in google maps api version 2 android

爱⌒轻易说出口 提交于 2019-12-12 21:12:41
问题 I want to make an application to display travel time and distance as well as the path to the location of the user's location to the destination location. Here is my TampilkanMap class: public class TampilkanMap extends FragmentActivity { GoogleMap googleMap; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.map); SupportMapFragment fm = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); googleMap = fm

Calculating Euclidean Distance for Large DataSets

 ̄綄美尐妖づ 提交于 2019-12-12 13:44:44
问题 I have to calculate Euclidean distance between train and test data. the total length of train data is 1389 and for test data is 364. It is basically the data from the handwritten ZIP codes on envelopes from U.S. postal mail, downloaded from the website of "Elements of Statistical learning". I am a beginner and just read the data in R package. I'm unable to start calculating distance between train and test data. Can anyone help me out to give me an idea that how to generate a loop for this

canberra distance - inconsistent results

ε祈祈猫儿з 提交于 2019-12-12 10:42:43
问题 I'm trying to understand what's going on with my calculation of canberra distance. I write my own simple canberra.distance function, however the results are not consistent with dist function. I added option na.rm = T to my function, to be able calculate the sum when there is zero denominator. From ?dist I understand that they use similar approach: Terms with zero numerator and denominator are omitted from the sum and treated as if the values were missing. canberra.distance <- function(a, b){

R - Calculate distance between two points along a polyline

巧了我就是萌 提交于 2019-12-12 09:48:24
问题 In R - I have imported a polyline shapefile that is not straight (represents a winding interstate highway) into the environment. I have read a .csv file that contains points (latitude/longitude in decimal degrees) into the environment. All of those points lie along the polyline. If I take two random points I can calculate the "as the crow flies" distance between them using great circle distance calculation. But what is needed is distance traveled along the polyline. See reference image: https

Shortest great circle distance between a point and a polygon on a sphere/globe

我是研究僧i 提交于 2019-12-12 08:56:45
问题 I have a set of polygons specified by geographic (WGS84) coordinates: they live on a sphere. I have a point specified by a latitude-longitude pair. I would like to (efficiently) find the minimum great circle distance between the point and the polygon. My current stack includes fiona, shapely, gdal, and proj. Similar questions on StackOverflow mostly seem to project features onto a plane and find distances there, or (disturbingly) omit mention of projections or lack thereof entirely. 回答1: This

calculate distance between each pair of coordinates in wide dataframe

大兔子大兔子 提交于 2019-12-12 08:13:53
问题 I want to calculate the distance between two linked set of spatial coordinates ( program and admin in my fake dataset). The data are in a wide format, so both pairs of coordinates are in the same row. library(sp) set.seed(1) n <- 100 program.id <- seq(1, n) c1 <- cbind(runif(n, -90, 90), runif(n, -180, 180)) c2 <- cbind(runif(n, -90, 90), runif(n, -180, 180)) dat <- data.frame(cbind(program.id, c1, c2)) names(dat) <- c("program.id", "program.lat", "program.long", "admin.lat", "admin.long")