473,799 Members | 2,683 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Extrapolate from NMEA file

I have a file with thousands of these lines:

$GPRMC,131334.0 0,A,4538.6259,N ,01021.4755,E,0 .43,0.0,021105, 1.3,E,A*0D
$GPGGA,131334.0 0,4438.6259,N,0 1021.4755,E,1,0 0,7.8,29.8,M,40 .2,M,,*5C
$GPRMC,131343.0 0,A,4538.6270,N ,01021.4789,E,2 .87,0.0,021105, 1.3,E,A*0F

I must capture ONE line EVERY 10 LINES but only a block of 200 lines
with the first columns begin with $GPGGA.

I must to extrapolate the [column3] and the [column5]
I must write new file with the rows like these:

Point([column5],[column3]),
Point([column5],[column3]),
Point([column5],[column3]),

and so on

<?
$file=file('fil e.txt');
[FUNCTION]
$fp = fopen("newfile. txt", "a");
[WRITE THE CORRECT ROWS]
fclose($fp);
?>

can you help me ?

Nov 3 '05 #1
6 2840
What have you unsuccessfully tried so far?

Greetings.

Nov 3 '05 #2
Hi Samuel,

thanks for your answer and sorry for my bad english.
Up to now I have stopped myself where you have read.
I do not have familiarity with the PHP language, but I must process the
GPS log.
I search someone that can help me to do this.
thanks.
Maggy

Nov 3 '05 #3
Hi Maggy,

If I understand you correctly, then the following pseudocode might be a
starting point

Ian
////////////////////////////////////

line_count=9 (assuming that you want the first line to count)

Open input file
Open output file

Do while not EOF
Read line from input file
Split line into an array
If col_1 is '$GPGGA'
Add 1 to line_count
If line count >9
write data to output file
set line_count to 0
end if
end if
Loop

At this point, if you want to capture the last record even if it's noth
the tenth one
if line_count <> 0 write data to output files

Close files

Nov 3 '05 #4
You have understand correctly the concept of my request, but now, I
don't know how can continue and this afternoon is been born a new
problem.
It must add also one conversion of column 3 and 5 of $GPGGA lines:
the value 4438.6259 will be convert in 44.38625 (latitude)

Maggy

Nov 3 '05 #5
> Up to now I have stopped myself where you have read.
I do not have familiarity with the PHP language, but I must process the
GPS log.


Hm, you'll need to read some things. Here's a handful of things that
may help you. Just search for these keywords in php.net and it should
be easy to learn some stuff and go from there...

- file system
- array
- strings

Greetings.

Nov 3 '05 #6
cu***@virgilio. it wrote:
I must capture ONE line EVERY 10 LINES but only a block of 200 lines
with the first columns begin with $GPGGA.

I must to extrapolate the [column3] and the [column5]
I must write new file with the rows like these:


I didn't realy understand what did you say but this is what could i
write from Ian B pseudo-code:

<?
$file1 = fopen("input.tx t", "r");
$file2 = fopen("output.t xt", "w");

// read every line (until EOF) and split it wiht space
while (($data = fgetcsv($file1, 1000, " ")) !== FALSE) {
if($data[0] == '$GPGGA'){
$row++;
}
if($row >= 10){
// Write output if got more than 10 lines
fwrite($file2, "Point($dat a[4],$data[2]\n");
}
}
fclose($file1);
fclose($file2);
?>

Nov 5 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
6130
by: Brandon Walters | last post by:
I wrote a file download module for my website. The reason for the file download module is that my website downloads work on a credit based system. So I need to keep track of and limit daily downloads. It uses fpassthru() and some headers() to send a file to the requesting user. The get.php file that I wrote (the file download module if you will) works like a charm for .ZIP files and .TXT files. However, when .EXE files are downloaded...
1
4681
by: balzano_1 | last post by:
Hi, im trying to upload a file from a client (windows) to an ftp server (linux), i deciede to use some of php`s functions to connect and authenticate etc.. i only wish to put a file on the server, so i used ftp_put() function, when i send the file via http, the file is created on the server, but it is empty, i checked the permissions and all are set correctly, i figured if it is empty it means it cant find the file im trying to upload, i...
0
4121
by: jjs0713 | last post by:
Hi, Everyone ! I made a C program. I want to know serial communication at micom which is ATMEL 89C52. It's received to micom RX pin(serial comm.) NMEA format from some set. I'd like to take UTC Time. then I'll display to LCD output. I really need to help which is to get UTC time from NMEA format. 1. NMEA format $GPGGA,000915.5,3727.85245,N,12702.53467,E,0,00,,684.6,M,18.5,M,,*71
2
5424
by: John | last post by:
Hi, I wrote an application that needs NMEA data. I would like to use the Delorme Bluetooth Earthmate GPS instead of the Garmin eMap (with a Belkin Serial-To-USB adpater) that I'm currently using. Has anyone been able to talk to a BT Earthmate from C#? I'm using the SerialPort.zip from www.gotdotnet.com. Thanks,
0
3944
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen. It is almost like it is trying to implement it's own COM interfaces... below is the header, and a link to the dll+code: Zip file with header, example, and DLL:...
0
2036
by: thjwong | last post by:
I'm using WinXP with Microsoft Visual C++ .NET 69462-006-3405781-18776, Microsoft Development Environment 2003 Version 7.1.3088, Microsoft .NET Framework 1.1 Version 1.1.4322 SP1 Most developers said to me that they have no problem doing that, but the following project file is said to be corrupted while opening in the IDE, it is the project file of NT xemacs BETA 21.5.24, http://ftp.xemacs.org/pub/beta/xemacs-21.5.24.tar.gz (under the...
4
2269
by: Doug Gray | last post by:
Folks, I am looking for a fast but most importantly a bullet proof method to pass and NMEA data stream (GPS output) ascii numeric strings. The best I can offer is: def fint(a): try: return int(float(a)) except: return 0 The reason for this is the quality of the data from the huge variety of
5
3398
by: Fab108 | last post by:
HI everyone, may i know how to do a code for reading in a nmea file and display it on google map?
1
1834
by: =?Utf-8?B?U29sdXRpb25hdGly?= | last post by:
I found lots of GPSapi code, including the one from the SDK. But how can i retrieve raw NMEA strings from the gps intermediate driver? I know I need to use createfile etc. But this is new for me, so could someone please provide some sample code (C# or VB)?
0
9689
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10495
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10269
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10248
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5597
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2942
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.