Click here to Skip to main content
15,894,740 members

to calculate distance of lat and long from database table and also difference of 1st and 2nd latlongs

naveen 2012 asked:

Open original thread
CSS
Figure : 1,
 Database table

Vehicleid   Latitude    Longitude   datetime
1   16.43924553090  79.92235564210  2012-12-19 16:00:00.000
1   16.43517902890  79.92466106060  2012-12-19 16:02:00.000
1   16.43111252690  79.92498125760  2012-12-19 16:04:00.000
1   16.42797459620  79.92517337580  2012-12-19 16:06:00.000
2   14.68807134570  79.50083987840  2012-12-19 17:12:00.000
2   14.68514259410  79.51420230760  2012-12-19 17:14:00.000
3   18.56690251930  82.50047999880  2012-12-19 18:22:00.000
3   18.56884750210  82.50426359800  2012-12-19 18:24:00.000

Based on above figure1 (database table), how to calculate distance between starting and ending points by using c# .net  and also at the same time insert the starting( lat& long) and ending (lat & long) as well as strating time, ending time, distance values in another table like below table


Vehicleid   Starting(lat & long)    Ending (lat  & long)    Distance(in kms)    Strat time  End time
1   16.43924553090, 79.92235564210  16.43517902890,
79.92466106060  ?   2012-12-19 16:00:00.000 2012-12-19 16:02:00.000
1   16.43517902890,
79.92466106060  16.43111252690,
79.92498125760  ?   2012-12-19 16:02:00.000 2012-12-19 16:04:00.000
1   16.43111252690,
79.92498125760  16.42797459620,
79.92517337580  ?   2012-12-19 16:04:00.000 2012-12-19 16:06:00.000
Tags: C# (C# 3.0), SQL Server 2005, ASP.NET, SQL Server

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900