distance

Cosine Similarity Measure: Multiple results

My program uses clustering to produce subsets of similar items and then uses the cosine similarity measure as a method of determining how similar the clusters are. For instance if user 1 has 3 clusters and user 2 has 3 clusters then every cluster is compared against each other, 9 results using the cosine similarity measure will be produc...

How to get nearby POIs

I have a database with Points of Interest that all have an address. I want to know what is the method/name/call to get all nearby POIs from a given position. I understand that I need to convert all my addresses to LAT / LON coordinates at least, but my question is: for a given LAT / LONG how do I get from the database/array what POIs ...

How can we calculate sea distances using waypoints ?

Hi Friends, I have one query in which I really stuck at that. I have port database with waypoints and also routing points which I need to use in distance calculation between two ports. I have done lots of R&D to find formula which gives me distance between two points. I also need shortest route which is possible. I have reviewed online...

What is the maximum distance from an anchor point to a bezier curve?

Given a cubic bezier curve P0,P1,P2,P3 with the following properties: Both P1 and P2 are on the same side of the line formed by P0 and P3. P2 can be projected onto the line segment formed by P0 and P3 but P1 cannot. What is the T value for the point on the curve farthest from P3? Here is an image with an example curve. The curve bu...

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

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 see...

Find the closest locations to a given address

I have built an application in CakePHP that lists businesses. There are about 2000 entries, and the latitude and longitude coordinates for each business is in the DB. I now am trying to tackle the search function. There will be an input box where the user can put a street address, city, or zipcode, and then I would like it to return t...

Querying a perimeter around a Geocode-Location (Lat/Lon)

Hi, how can I search for geo-objects in a certain perimeter ? E.g. I have several objects with Lat/Lon coordinates stored in my DB. Now I want to retrieve all the objects which lie in a specific perimeter (10 miles or 20 miles) around a given point. I guess what I would have to do is to form some query like: SELECT * FROM objects o w...

Blackberry: Return value of Coordinates.distance()

I want to know metric of the value returned by Coordinates.distance() ...

How to access a grid using ArcObgect

How can I get value of each cells of grid using ArcObject? Grid was created by Spatial Analyst -> Distance ->Straight Line I need to use this values for other operations. Please, help me! ...

Relative Position in PHP between 2 points (Lat/Long)

I have a database of airports with Latitude and Longitude for each point. I want to run a PHP script to find all airports that are nearby a given airport, with their distance and relative direction. I.e. for Airport KLDJ (40-37-02.810N 074-14-40.539W) Airport Nearby KJFK - John F Kennedy Airport (21.2 nm NE) (40-38-23.104N 073-46...

In a graph, how to find the nearest node to a group of nodes?

Hello, I have an undirected, unweighted graph, which doesn't have to be planar. I also have a subset of graph's nodes (true subset) and I need to find a node not belonging to the subset, with minimum sum of distances to all nodes in the subset. So far, I have implemented breath-first search starting from each node in the subset, and th...

Fastest way to compute point to triangle distance in 3D?

One obvious method for computing the minimum distance from a point to a 3D triangle is to project the point onto the plane of the triangle, determine the barycentric coordinates of the resulting point, and use them to determine whether the projected point lies within the triangle. If not, clamp its the barycentric coordinates to be in t...

Distance between Long Lat coord using SQLITE

I've got an sqlite db with long and lat of shops and I want to find out the closest 5 shops. So the following code works fine. if(sqlite3_prepare_v2(db, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) { while (sqlite3_step(compiledStatement) == SQLITE_ROW) { NSString *branchStr = [NSString stringWithUTF8Str...

SQL Server 2008 Geography .STBuffer() distance measurement units

I'm working with a geographic point using lat/long and need to find other points in our database within a 5 mile radius of that point. However, I can't seem to find out what the "units" are for STBuffer, it doesn't seem to conform to feet, miles, meters, kilometers, etc. The documentation only refers to them as "units", any suggestions? ...

Earth Mover's Distance computation in 3D

Is there a package out there that can compute the Earth Mover's Distance on two 3D grid inputs? Barring that, is there some example code or algorithm description for computing it efficiently? ...

Calculating all distances between one point and a group of points efficiently in R

Hi, First of all, I am new to R (I started yesterday). I have two groups of points, data and centers, the first one of size n and the second of size K (for instance, n = 3823 and K = 10), and for each i in the first set, I need to find j in the second with the minimum distance. My idea is simple: for each i, let dist[j] be the distanc...

Given the lat/lon of 2 close points on earth (<10m), How do I calculate the distance in metres?

I have the lat/lon of 2 points on the earth. They are really close together, <10m. Let's assume the earth is flat. How do I calculate the distance between them in metres? I know about tools (PostGIS, etc.) that can do this correctly, however I'm just doing a rough and ready type, and I'm OK with low accuracy. At such small sizes a diffe...

Shortest distance between points on a toroidally wrapped (x- and y- wrapping) map?

I have a toroidal-ish Euclidean-ish map. That is the surface is a flat, Euclidean rectangle, but when a point moves to the right boundary, it will appear at the left boundary (at the same y value), given by x_new = x_old % width Basically, points are plotted based on: * see edit (x_new, y_new) = ( x_old % width, y_old % height) Thin...

Find distance between two points using MKMapKit

Hi, I'm attempting to find the euclidean distance in meters between two points on an MKMapView using iPhone OS 3.2. The problem is that I have these coordinates in terms of latitude and longitude, which, mathematically provides me enough data to find the distance, but it's going to take some tricky trigonometry. Is there any simpler sol...

Hamming distance and CRC.

Hi guys, How to find the Hamming distance of a code generated by a certain CRC? Assume that I have a generating polynomial of order, say, 4 and 11 bits of data. How to compute the HD basing only on these information? Cheers. ...