distance

MySQL WordPress Query Returning a Distance of Zero for Some Records

五迷三道 提交于 2019-12-13 07:22:16
问题 I wrote a query against a WordPress Database that selects the 10 closest restaurants, ordered by distance. For some reason, the first three have a distance of zero and I can't for the life of me figure out why. Any ideas? Here is the SQL: SELECT pm1.post_id, (6371 * acos( cos( radians(51.507351) ) * cos( radians( pm1.meta_value) ) * cos( radians(pm2.meta_value) - radians(-0.127758)) + sin(radians(51.507351)) * sin( radians(pm1.meta_value))) ) AS distance, pm1.meta_value AS lat, pm2.meta_value

Find close points from a list of longitudes and latitudes

ⅰ亾dé卋堺 提交于 2019-12-13 06:28:03
问题 I have a dataframe consisting of three columns, "Point_name" "longitude" and "latitude" Point_Name Longitude Latitude University of Arkansas 36.067832 -94.173655 Lehigh University 40.601458 -75.360063 Harvard University 42.379393 -71.115897 Is there an R package I can use to calculate distances between each point? The aim is to get R to "measure" the distance between points and then produce either a dataframe of points that have another point within "X" (eg. 500 meters) distance radius or

How to setup a MapViewController as Datasource to a TableViewController for displaying distance in cells

别来无恙 提交于 2019-12-13 05:59:55
问题 My app has a tabbarcontroller with a UIViewController (FirstViewController-calling it mapVC) with a mapview and a UITableViewController (SecondViewController-calling it tableVC). The app fetches data from web and puts it into CD-db and each VC executes a fetch to the db. Each entity is named Holiday (dont ask) and it has a lat and long property. Here is the UITabBarController subclass which attempts to set the mapVC as datasource to tableVC: - (void)viewDidLoad{ [super viewDidLoad]; // Do any

using levenshtein distance ratio to compare 2 records

拜拜、爱过 提交于 2019-12-13 05:57:55
问题 I've created the mysql user function using the levenshtein distance and ratio source codes. I am comparing 2 records and based on a 75% match I want to select the record. Order comes into table paypal_ipn_orders with an ITEM title A query executes against a table itemkey to find a 75% match in a record called ITEM as well if a 75% title is match it assigns an eight digit number from table itemkey to table paypal_ipn_orders Here is the query UPDATE paypal_ipn_orders SET sort_num = (SELECT sort

C++ Distance Function Keeps Returning -1

China☆狼群 提交于 2019-12-13 05:18:56
问题 I've created a program that computers the distance between two points, and finds the slope as well. 1) How would I go about changing the program to strictly pointers? 2) The distance function returns "-1" no matter what the input. I'm 100% sure my arithmetic is correct, but something seems to go wrong. // This program computes the distance between two points // and the slope of the line passing through these two points. #include<iostream> #include<iomanip> #include<cmath> using namespace std;

How to find the distance between two points given longitude and latitude in python-error?

允我心安 提交于 2019-12-13 04:39:11
问题 I have two locations with longitude and latitude given and I would like to get the distance between these points in python. My data set looks like below: df_TEST = pd.DataFrame({'Location': ['X'], 'Long': [ 28.63615701706], 'Lat': [ 41.0693487044612], 'Location1': ['Y'], 'Long1': [30.7158891385255], 'Lat1': [36.963486025471]}) My solution as suggested Getting distance between two points based on latitude/longitude df_TEST['distance']=geopy.distance.geodesic(( df_TEST['Long'], df_TEST['Lat']),

How to avoid quadratic computation resulting from double 'for loop' when computing distances between vectors

落爺英雄遲暮 提交于 2019-12-13 04:33:14
问题 Given the following code that computes distances between vectors in list 'vect’: import numpy as np vect=([0.123, 0.345, 0.789], [0.234, 0.456, 0.567],[0.134, 0.246, 0.831]) def kn(): for j in vect: c=np.array(j) for z in vect: p=np.array(z) space = np.linalg.norm(c-p) print space kn() Is there a way to avoid the quadratic complexity that will result from the double ‘for loop’? Computation as a result of the double for loop (quadratic) ==3X3=9 Ideal computation (what I want) should be (3): [0

How find Distance between two addresses through php

不羁的心 提交于 2019-12-13 04:12:25
问题 i am looking for some help to find the distance between two address through php as i can not use the google maps api. so get a way from this post Distance between two addresses but i need to know how can send the request using URL pattern and grab the repose to save them in database. http://maps.google.com/maps/api/directions/xml?origin=550+Madison+Avenue,+New+York,+NY,+United+States&destination=881+7th+Avenue,+New+York,+NY,+United+States&sensor=false thanks for any suggestion. //////////////

How to calculate distance from points in lists?

痞子三分冷 提交于 2019-12-13 03:48:11
问题 I have two group of lists, A and O. Both of them have points from x,y z coordinate. I want to calculate the distance between points from A and B. I used a for loop, but it only give me one result. It should give me 8 numbers from the results. I'm very appreciate that someone can have a look. It's the last step in my project. Ax = [-232.34, -233.1, -232.44, -233.02, -232.47, -232.17, -232.6, -232.29, -231.65] Ay = [-48.48, -49.48, -50.81, -51.42, -51.95, -52.25, -52.83, -53.63, -53.24] Az = [

Xamarin - How to calculate distance in realtime via GPS

泪湿孤枕 提交于 2019-12-13 03:35:38
问题 How can i calculate distance in real time(the distance must increment if there is a movement) via GPS ? I have an App that shows the travelling speed, and it is accurate. I just need to show the distance that was traveled by the user. How can i archive this ? Please see my code below : public void OnLocationChanged(Location location) { try { currentLocation = location; if (currentLocation == null) { //"Make sure the GPS is on."; } else { gpsLatitude = currentLocation.Latitude.ToString();