electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

How to calculate the distance between two points on the Eart


Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> How to calculate the distance between two points on the Eart
Author Message
john168



Joined: 17 Mar 2004
Posts: 14


Post20 May 2004 10:05   

geofence calculation


Crying or Very sad Please help me:
How to calculate the distance between two points on the Earth
I use pic16f77.
latitude and longitude of gps nmea0183.
my email:john168168(at)21cn.com

;-----------------------------------------------
Thank all

My design is tracing system,When car go out the Geo-fence area,the system will send message to Alarm Center.The Geo-fence types will be available:round and rectangular.The round area include two values:the original(latitude,longitude) and the radius(km).The rectangular area include two points(lat,long).
I need calculate that is car in the area? I need not exactitude calculate.

john
;----------------------------------------------


Last edited by john168 on 23 May 2004 6:57; edited 2 times in total
Back to top
scoppulal



Joined: 18 Apr 2004
Posts: 131
Helped: 1


Post20 May 2004 10:46   

windsway geodesy


hi,
you should say what approximation you can accept.
There are many way to calculate that distance, for example you could use a spherical earth or, better, a ratational ellipsoid model of the Earth.

It is up to you.
regards
Back to top
stub27



Joined: 02 Mar 2002
Posts: 20


Post20 May 2004 16:00   

how to calculate fence radius between 2 points


Not especially for Up, but it can give you ideas:

http://www.codeguru.com/Cpp/Cpp/algorithms/general/article.php/c5115/
Back to top
Google
AdSense
Google Adsense




Post20 May 2004 16:00   

Ads




Back to top
C-Man



Joined: 19 Jul 2001
Posts: 1235
Helped: 73


Post20 May 2004 16:22   

pic16f77 geofence


john168,

you can find the mathematics you need here:
http://williams.best.vwh.net/avform.htm

But I am really not shure if this is doable with a PIC.

I designed an 8051 based GPS logger years ago and programmed everything in assembler using the math routines from Intel 8051 basic which have 8 digit BCD precision ...

The PIC math routines have only 24 or 32 bit precision (including the mantissa) and I am afraid this is not enough for the great circle distance calculation, also you might get into trouble with the limited code space because floating point routines are very memory hungry.

If the distances you have to calculate are max. 20 Km you can assume the earth is flat and calculate the distance using good old Pythagoras Smile

hope this helps and best wishes to your project
Back to top
asit



Joined: 22 Mar 2002
Posts: 95
Helped: 3
Location: India


Post20 May 2004 16:58   

geofencing algorithms simple


Convert the Latitude/Longitude to UTM cordinates. Use the good old formula sqr(((x1-x2)^2)+((y1-y2)^2)). This will give you the distance in meters. But the mathematics involved may not work on limited RAM/Flash of pic. Search for mapstuff for a visual basic code.

. ' The original Visual Basic code is:
' mapstuff.bas version 0.92 released 06/25/2002
' geodesy.cls version 0.91 released 06/25/2002
'
' The initial developer of the Visual Basic code is < Victor Fraenckel>
' (vfraenc1(at)nycap.rr.com).
'
' Portions created by < Victor Fraenckel> are
' Copyright (C) 2002 < Windsway Instrument Company>.
'
'
' Obtained through:
'
' Windsway Instrument Company
Back to top
john168



Joined: 17 Mar 2004
Posts: 14


Post23 May 2004 6:50   

distance between two points spherical earth c++


Thank all

My design is tracing system,
When car go out the Geo-fence area,the system will send message to Alarm Center.
The Geo-fence types will be available:round and rectangular.
The round area include two values:the original(latitude,longitude) and the radius(km).
The rectangular area include two points(lat,long).
I need calculate that is car in the area?

john
Back to top
C-Man



Joined: 19 Jul 2001
Posts: 1235
Helped: 73


Post23 May 2004 8:01   

the eart longitudes


john168,

again if the distance is small (max 20Km) you can calculate with simple pythagoras method.

If a small error is acceptable you can use this method also for larger distances (maybe 100Km).

If you want to use a rectangular area you will just have to compare latitude and longitude with min and max values for your limits.

For a circular area you will have to use the distance furmulae but again you can simplify things by using pythagoras for small distances or if you accept a small error.

But doing this in a pic is not too simple as code space is very limited. Which programming language are you going to use (assembler, CCS C, Hi-Tech C or IAR C)?

hope this helps and best regards
Back to top
john168



Joined: 17 Mar 2004
Posts: 14


Post24 May 2004 2:19   

calculating error between two points


C-man:
Thanks
I use assembler. Hope the code less 500 bytes.
John yin (China)
Back to top
C-Man



Joined: 19 Jul 2001
Posts: 1235
Helped: 73


Post24 May 2004 6:11   

site:www.edaboard.com geofence calculation


Check out the Microchip Floating Point Routines here:
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en010961

But I am afraid it will not be possible to implement what you want to do in 500 bytes of rom Sad

best regards
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> How to calculate the distance between two points on the Eart
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
How to calculate distance between two tracks (2)
How to calculate the mutual impedance between two dipoles (5)
How to calculate the adjacent points of a 16 QAM (1)
How to calculate the power stripes in encounter 10 points (3)
distance between the feed and the radiating element (1)
how to calculate the parasitic capacitance between wires? (5)
how to simulate the operation between two antennas (8)
how can i get the difference between two voltage (7)
distance between antennas on the tower (2)
what's the difference between the two xilinx constraints (2)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS