One way to find the shortest distance between a series of surface (x, y) points is to let Python module itertools find the non-repeating combinations of point pairs. Now you can apply the Pythagoras' theorem to find all the distances and the minimum distance.

Member Avatar
Member Avatar
+3 forum 2

Knowing the longitude and latitude coordinates of two cities you can calculate the distance between them. Use the code in https://www.daniweb.com/software-development/python/code/490561/postal-code-zips-and-location-python to find the coordinates.

Member Avatar
+3 forum 0

Hello, I have the following problem: Entering coordinates of points on a plain with keyboard (as rows x,y). Analysing this coordinates. Replacing coordinates in vector (point - structure data type). Then calculating distance from the first point to all another points. I've written the code of this problem using arrays -> formula r=sqrt( (x[i]-x[1])^2+(y[i]-y[1])^2) ), (coordinate plain). #include <stdio.h> #include <iostream.h> #include <math.h> main() { float x[100], y[100]; int i, n; float r; cout << "Enter dimension of 1D massives (vectors of X & Y coordinates)\n"; cin >> n; cout << "Enter X coordinates of points for the 1st 1D …

Member Avatar
Member Avatar
+0 forum 5

If I input an arbitrary amount of points [x1,y1].....[xn,yn] into a function I need to somehow return/print the shortest distance between all of the points. I understand how to find the distance between two points (fairly easy and straight forward), but how do I take an arbitrary amount of points and test each point with one another without testing each point with itself.

Member Avatar
Member Avatar
+0 forum 2

How do i implement levenshtein disance on records in a database table using python? I know how to connect python with database, coding in python may not be problem, and I also have the records in a database table. The problem is how do i make it work. Below is a snipet of my database table: Author Title of pub. Journal Michael I James Advancement in networking ACM Michael J Inse Advancement in networking ACM Any ideas will be appreciated. Thanks in advance.

Member Avatar
Member Avatar
+0 forum 1

So I've been working on a page to locate shops based on zip code and mile distance. I used this tutorial as a walk-through http://htmlcampus.com/build-a-zip-code-store-locator-application-in-php/ Now I've changed a couple of things like the mySQL table is called locations instead of zip_codes. I've tested it and it connects to the database and all, but it just says that **no results were found**, even when I enter in an exact zip code of one of the shops (90278 or 92602). http://bit.ly/Me2d1M Below is my code for the page (password left out). I hope someone could spot what might be wrong, something …

Member Avatar
Member Avatar
+0 forum 7

Hi all. I'm having trouble with this simple Java program. When I compile it, numerous errors would happen. I put in let's say 50 miles for the speed of the car and 2 hours for the traveling hours. I run it and it you see this: Hours Distance Traveled --------------------------------- 2 100 2 100 It doesn't display the 1 hour which it's supposed to be 50 miles traveled. Also, I try to test the while loops with negative or 0 inputs, and I get a repeat of the output which looks like this: Enter the speed of the vehicle in …

Member Avatar
Member Avatar
+0 forum 4

Hi, basically ive been trying to write code to work out where the nearest station for a person is based on their current location. I did have it working to display nearest station name and distance from that station but something went wrong I must have accidently deleted something or done something to it. Anyways I would appreciate it if someone could help me out and tell me where I've gone wrong When trying to build the code it says no main classes exist The code is [CODE] /* * To change this template, choose Tools | Templates * and …

Member Avatar
Member Avatar
+0 forum 3

I have a database full of user. This is roughly how the database looks: [CODE]| username | sex | birthdate | zip_code | |----------+-----+------------+----------| | coolUser | M | 02-14-1987 | 90210 | | blueUser | F | 06-16-1982 | 10011 | | . | . | . | . | | . | . | . | . | | . | . | . | . |[/CODE] A user will be able to search the database for another user based on their sex, age and distance. I have another database with a list of zipcodes in the U.S. …

Member Avatar
Member Avatar
+0 forum 2

I have a database full of user. This is roughly how the database looks: [CODE]| username | sex | birthdate | zip_code | |----------+-----+------------+----------| | coolUser | M | 02-14-1987 | 90210 | | blueUser | F | 06-16-1982 | 10011 | | . | . | . | . | | . | . | . | . | | . | . | . | . |[/CODE] A user will be able to search the database for another user based on their sex, age and distance. I have another database with a list of zipcodes in the U.S. …

Member Avatar
Member Avatar
+0 forum 1

SELECT * , 3956 *2 * ASIN( SQRT( POWER( SIN( ( 122.4058 - ABS( dest.lat ) ) * PI( ) /180 /2 ) , 2 ) + COS( 122.4058 * PI( ) /180 ) * COS( ABS( dest.lat ) * PI( ) /180 ) * POWER( SIN( ( 37.7907 - dest.lon ) * PI( ) /180 /2 ) , 2 ) ) ) AS distance FROM members dest HAVING distance <25 Above query run perfectly .. Users will have one field name search_distance .. So i want to calculate users location and current location distance based in search_distance too.. Please …

Member Avatar
Member Avatar
+0 forum 1

Problem: solve the following Source of SHORTEST DISTANCE path of A,B,C,D,E,F,G. I already did link the strings of dots of ABCDEFG and made a polygon which is the other objectives, my only problem now is calculating the source of the shortest distance part of A,B,C,D,E,F,G. Am using net beans. Guys can you please help me? am very much confused. /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author User */ public class paths{ } import java.awt.Color; import java.awt.Graphics; import java.swing.*; public class paths { private static …

Member Avatar
Member Avatar
+0 forum 7

i see this code in this thread, i want to know how to get input by user or from file in this code. for example this list how to use it as input in this code. i don't know how to modify and how to use it. Daniweb thread reference = [url]http://www.daniweb.com/software-development/cpp/threads/282872[/url] for example this list as input 96 48 91 94 77 31 3 2 68 17 33 9 52 23 99 78 25 63 18 89 98 54 82 64 31 98 99 71 97 36 32 49 [CODE]#include <iostream> #include <vector> #include <math> using namespace std; struct …

Member Avatar
Member Avatar
+0 forum 1

Dear Frendz, How to find distance between two latitude and longitude points using php.

Member Avatar
Member Avatar
-2 forum 4

Could someone give me help on how to simplify this? Trying to write code to solve this equation: Distance = sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2) I subbed a,b,c as the second set of coords. Im probably using too many vars as weel but im new, give it some time. [code] void school(int x,int y,int z, int a,int b,int c); int main() {int a,b,c,x,y,z; cout<< "enter coordinates plz"<<endl; cin>>x>>y>>z>>a>>b>>c; school(x,y,z,a,b,c); return 0; } void school(int x,int y,int z,int a,int b,int c) {float d,e,f,g,h; d=x-a; e=y-b; f=z-c; g=powf(d,2)+powf(e,2)+powf(f,2); h=sqrtf(g); cout<<"the answer is "<<h; } [/code]

Member Avatar
Member Avatar
+0 forum 6

hello. I am quite new in python so i have a question. I have a csv file in which i have names of 30 cities and their coordinates(lat and long). i want to generate a distance matrix for these cities. How can i do this ?

Member Avatar
Member Avatar
+0 forum 85

Hi.. how to calculate distance between two points.. each point have a coordinates (x,y). please help..

Member Avatar
Member Avatar
+2 forum 1

Hello Everyone, I have a list of digits. What is the most efficient way to count the number of tokens between two known digits? Here is what I came up with: [CODE] def dis(l, a1, a2): i1 = l.index(a1) i2 = l.index(a2) distance = i2 - i1 - 1 return distance [/CODE] E.g. l = [1, 2, 3, 4, 5] >>> print dis(l, 1, 5) 3 >>> print dis(l, 1, 3) 1 >>> print dis(l, 3, 4) 0 Is there a better (=faster) way of doing this? Thank you, m.

Member Avatar
Member Avatar
+0 forum 2

Hi I have several PCs and want to connect them on a home network. It makes sense to upgrade to a gigbit system. The trouble is how far may I locate a pc from the keyboard, mouse, and display?

Member Avatar
Member Avatar
+0 forum 5

The End.