haversine

Identifying groups of two rows that satisfy three conditions in a dataframe

浪子不回头ぞ 提交于 2019-12-11 04:27:19
问题 I have the df below and want to identify any two orders that satisfy all the following condtions: Distance between pickups less than X miles Distance between dropoffs less Y miles Difference between order creation times less Z minutes Would use haversine import haversine to calculate the difference in pickups for each row and difference in dropoffs for each row or order. The df I currently have looks like the following: DAY Order pickup_lat pickup_long dropoff_lat dropoff_long created_time 1

Geolocation and Haversine formula

╄→гoц情女王★ 提交于 2019-12-11 03:19:06
问题 I am trying to create a basic web application that detects the users geolocation, queries a mySQL database, and returns all bus stops within say 5 kilometers. The GTFS feed including the Longitude and Latitude have been inserted into a mySQL database, and I found a example HTML page that provides the Longitude and Latitude of the browser accessing the web application. I am seeking some help writing the mySQL query that takes this information and returns the results. 回答1: Although the great

google maps API geocode finds nearby KML

一个人想着一个人 提交于 2019-12-11 03:15:02
问题 I've seen a number of people ask about this on Google Maps discussion groups to productive discussion, so I thought I would try here. Goal: make a searchable map in Google Maps API that can return "nearby" results from a dataset when a user address is entered. My approach so far: I started by putting my datapoints into KML since it is both a) easily used by Google Maps API, and b) an XML document, and so easy to traverse. As I understand it, the Geocode method is the API's basic point of

Efficiently compute pairwise haversine distances between two datasets - NumPy / Python

限于喜欢 提交于 2019-12-11 01:30:38
问题 I want to calculate the geo-distance between latitude-longitude. I had checked this thread Vectorizing Haversine distance calculation in Python but when I am using it for two different set of coordinates, I m getting an error. df1 size can be in millions and if there is any other way to calculate accurate geo distance in less time then it would be really helpful. length1 = 1000 d1 = np.random.uniform(-90, 90, length1) d2 = np.random.uniform(-180, 180, length1) length2 = 100 d3 = np.random

Having/Where clause not working for Haversine Formula using Microsoft SQL

断了今生、忘了曾经 提交于 2019-12-10 10:58:56
问题 Here is my table named "test" - Check the snapshot here test And then my row items: here - rowitems I'm using the haversine formula, he is my query SELECT *, ( 3960 * acos( cos( radians( 33.650800 ) ) * cos( radians( Latitude ) ) * cos( radians( Longitude ) - radians( -117.891729 ) ) + sin( radians( 33.650800 ) ) * sin( radians( Latitude ) ) ) ) AS Distance FROM test For some reason the HAVING or WHERE clause is not working with Distance . It works with Latitude or Longitude . But when I try

MySQL geospacial search using haversine formula returns null on same point

此生再无相见时 提交于 2019-12-10 10:51:19
问题 I'm trying to implement a geospacial search in a php application. Currently, I'm using the following query to find points within 10km of a given latitude and longitude: SELECT * FROM ( SELECT *, (6378.1 * ACOS( COS(RADIANS(48.856614)) * COS(RADIANS(latitude)) * COS(RADIANS(2.3522219) - RADIANS(longitude)) + SIN(RADIANS(48.856614)) * SIN(RADIANS(latitude))) ) AS distance FROM `destinations_info` WHERE latitude BETWEEN 48.856614 - (10 / 69) AND 48.856614 + (10 / 69) AND longitude BETWEEN 2

Pairwise haversine distance calculation

最后都变了- 提交于 2019-12-09 18:36:20
问题 I have two arrays with lat and long. I want to calculate distance between every pair of lat and long with every other pair of lat and long in the array. Here are my two arrays. lat_array array([ 0.33356456, 0.33355585, 0.33355585, 0.33401788, 0.33370132, 0.33370132, 0.33370132, 0.33371075, 0.33371075, 0.33370132, 0.33370132, 0.33370132, 0.33356488, 0.33356488, 0.33370132, 0.33370132, 0.33370132, 0.33401788, 0.33362632, 0.33362632, 0.33364007, 0.33370132, 0.33401788, 0.33401788, 0.33358399, 0

C, Calculating the distance between two GPS locations?

谁都会走 提交于 2019-12-08 03:20:23
问题 If I have two GPS locations, say 51.507222, -0.1275 and 48.856667, 2.350833, what formula could I use to calculate the distance between the two? I've heard a lot about a haversine formula, but can't find any information about it, or how to apply it to C. I've written the following code, however, it's very innacurate. Anybody know why? I can't figure it out. The problem comes from the function itself, but I don't know what it is. float calcDistance(float A, float B, float C, float D) { float

Merge long/lat points within a bounding box depending on a radius in MySQL

拈花ヽ惹草 提交于 2019-12-07 18:40:18
问题 Here is a pic of what I basically want to achieve: So as the title says, I want to merge long/lat points which they're radius (of 25Kms for example) touch inside a bounding box of long/lat points. Here is my very simple DB structure: +-------+-------------+------------+ | id | long | lat | +-------+-------------+------------+ | 1 | -90.27137 | 50.00702 | | 2 | -92.27137 | 52.00702 | | 3 | -87.27137 | 48.00702 | | 4 | -91.27137 | 51.00702 | +-------+-------------+------------+ Here is my query

Having/Where clause not working for Haversine Formula using Microsoft SQL

孤街浪徒 提交于 2019-12-06 11:37:58
Here is my table named "test" - Check the snapshot here test And then my row items: here - rowitems I'm using the haversine formula, he is my query SELECT *, ( 3960 * acos( cos( radians( 33.650800 ) ) * cos( radians( Latitude ) ) * cos( radians( Longitude ) - radians( -117.891729 ) ) + sin( radians( 33.650800 ) ) * sin( radians( Latitude ) ) ) ) AS Distance FROM test For some reason the HAVING or WHERE clause is not working with Distance . It works with Latitude or Longitude . But when I try to do WHERE Distance < 10 or HAVING Distance < 10 . It says Distance is an invalid column name . I need