473,411 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Extrapolate from NMEA file

I have a file with thousands of these lines:

$GPRMC,131334.00,A,4538.6259,N,01021.4755,E,0.43,0 .0,021105,1.3,E,A*0D
$GPGGA,131334.00,4438.6259,N,01021.4755,E,1,00,7.8 ,29.8,M,40.2,M,,*5C
$GPRMC,131343.00,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('file.txt');
[FUNCTION]
$fp = fopen("newfile.txt", "a");
[WRITE THE CORRECT ROWS]
fclose($fp);
?>

can you help me ?

Nov 3 '05 #1
6 2823
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.txt", "r");
$file2 = fopen("output.txt", "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($data[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
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...
1
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,...
0
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...
2
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...
0
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....
0
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...
4
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...
5
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
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,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...

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.