distance

Parallel distance Matrix in R

梦想的初衷 提交于 2019-12-17 18:10:27
问题 currently I'm using the build in function dist to calculate my distance matrix in R. dist(featureVector,method="manhattan") This is currently the bottlneck of the application and therefore the idea was to parallize this task(conceptually this should be possible) Searching google and this forum did not succeed. Does anybody has an idea? 回答1: Here's the structure for one route you could go. It is not faster than just using the dist() function, instead taking many times longer. It does process

Manhattan Distance between tiles in a hexagonal grid

不问归期 提交于 2019-12-17 17:50:48
问题 For a square grid the euclidean distance between tile A and B is: distance = sqrt(sqr(x1-x2)) + sqr(y1-y2)) For an actor constrained to move along a square grid, the Manhattan Distance is a better measure of actual distance we must travel: manhattanDistance = abs(x1-x2) + abs(y1-y2)) How do I get the manhattan distance between two tiles in a hexagonal grid as illustrated with the red and blue lines below? 回答1: I once set up a hexagonal coordinate system in a game so that the y -axis was at a

How to add markers on Google Maps polylines based on distance along the line?

不问归期 提交于 2019-12-17 10:15:28
问题 I am trying to create a Google Map where the user can plot the route he walked/ran/bicycled and see how long he ran. The GPolyline class with it’s getLength() method is very helpful in this regard (at least for Google Maps API V2), but I wanted to add markers based on distance, for example a marker for 1 km, 5 km, 10 km, etc., but it seems that there is no obvious way to find a point on a polyline based on how far along the line it is. Any suggestions? 回答1: Having answered a similar problem a

Calculating distance between zip codes in PHP

こ雲淡風輕ζ 提交于 2019-12-17 05:41:07
问题 I grabbed a database of the zip codes and their langitudes/latitudes, etc from this This page. It has got the following fields: ZIP, LATITUDE, LONGITUDE, CITY, STATE, COUNTY, ZIP_CLASS The data was in a text file but I inserted it into a MySQL table. My question now is, how can i utilise the fields above to calculate the distance between two zip codes that a user can enter on the website? Working code in PHP will be appreciated 回答1: You can also try hitting a web service to calc the distance.

Function to calculate distance between two coordinates

蓝咒 提交于 2019-12-17 04:11:40
问题 I'm currently using the function below and it doesn't work properly. According to Google Maps, the distance between these coordinates (from 59.3293371,13.4877472 to 59.3225525,13.4619422 ) are 2.2 kilometres while the function returns 1.6 kilometres. How can I make this function return the correct distance? function getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2) { var R = 6371; // Radius of the earth in km var dLat = deg2rad(lat2-lat1); // deg2rad below var dLon = deg2rad(lon2-lon1); var a

What is the fastest algorithm to calculate the minimum distance between two sets of points?

喜欢而已 提交于 2019-12-17 03:42:41
问题 I want to find the minimum distance between two polygons. I have to find the minimum of shortest distance between each vertex of first shape with all of the vertices of the other one. Something like the Hausdorff Distance, but I need the minimum instead of the maximum. 回答1: Perhaps you should check out ( PDF warning! Also note that, for some reason, the order of the pages is reversed ) "Optimal Algorithms for Computing the Minimum Distance Between Two Finite Planar Sets" by Toussaint and

What is the fastest algorithm to calculate the minimum distance between two sets of points?

喜你入骨 提交于 2019-12-17 03:42:28
问题 I want to find the minimum distance between two polygons. I have to find the minimum of shortest distance between each vertex of first shape with all of the vertices of the other one. Something like the Hausdorff Distance, but I need the minimum instead of the maximum. 回答1: Perhaps you should check out ( PDF warning! Also note that, for some reason, the order of the pages is reversed ) "Optimal Algorithms for Computing the Minimum Distance Between Two Finite Planar Sets" by Toussaint and

Distance calculation from my location to destination location in android

二次信任 提交于 2019-12-17 02:38:10
问题 I have to made a project where i need to calculate the distance from my location to destination location and show it in a textview.Here note that this distance updated when my location change.Is it possible to make such type of project ? [NOTE: without implementing Google map i have to make it.The destination lon ,lat is known.Just have to find my location and make the calculation] 回答1: check the documentation on the google android dev page to see how to listen for position changes. http:/

Efficiently compute pairwise squared Euclidean distance in Matlab

若如初见. 提交于 2019-12-16 20:15:44
问题 Given two sets of d -dimensional points. How can I most efficiently compute the pairwise squared euclidean distance matrix in Matlab? Notation: Set one is given by a (numA,d) -matrix A and set two is given by a (numB,d) -matrix B . The resulting distance matrix shall be of the format (numA,numB) . Example points: d = 4; % dimension numA = 100; % number of set 1 points numB = 200; % number of set 2 points A = rand(numA,d); % set 1 given as matrix A B = rand(numB,d); % set 2 given as matrix B

Calculating distance between two geographic locations

…衆ロ難τιáo~ 提交于 2019-12-16 20:12:43
问题 please shed some light on this situation Right now i have two array having latitude and longitude of nearby places and also have the user location latiude and longiude now i want to calculate the distance between user location and nearby places and want to show them in listview. I know that there is a method for calculating distance as public static void distanceBetween (double startLatitude, double startLongitude, double endLatitude, double endLongitude, float[] results); Now what is the