Professional Web Applications Themes

Information from a file ... - PHP Development

I've got a text file full of GPS information and am looking at pulling out the relevant information and storing in an array. What's the best method of getting this information out? Here's an example of the data file ... Thanks. H SOFTWARE NAME & VERSION I GPSU 4.20 01 FREEWARE VERSION S DateFormat=dd/mm/yyyy S Units=M,M S SymbolSet=3 H R DATUM M E WGS 84 100 0.0000000E+00 0.0000000E+00 0 0 0 H COORDINATE SYSTEM U LAT LON DM F ID---- Latitude Longitude Symbol------- T Alt(m) Comment W MOB001 N5121.4870' W00018.1860' filled circle I 0.0 W MOB002 N5111.0860' W00019.4050' filled circle ...

  1. #1

    Default Information from a file ...

    I've got a text file full of GPS information and am looking at pulling out
    the relevant information and storing in an array. What's the best method of
    getting this information out? Here's an example of the data file ... Thanks.


    H SOFTWARE NAME & VERSION
    I GPSU 4.20 01 FREEWARE VERSION
    S DateFormat=dd/mm/yyyy
    S Units=M,M
    S SymbolSet=3

    H R DATUM
    M E WGS 84 100 0.0000000E+00 0.0000000E+00 0 0 0

    H COORDINATE SYSTEM
    U LAT LON DM

    F ID---- Latitude Longitude Symbol------- T Alt(m) Comment
    W MOB001 N5121.4870' W00018.1860' filled circle I 0.0
    W MOB002 N5111.0860' W00019.4050' filled circle I 7.0

    H TRACK SUMMARY
    H Track Pnts. Date Time StopTime seconds m
    m/s Alt(m)
    H 193 24/07/2005 10:08:01 18:59:54 31913 92267
    2.9 1437.0

    F Latitude Longitude Alt(m) Date Time S seconds
    m m/s
    T N5121.5730' W00018.4630' 27.0 24/07/2005 10:08:01 1
    T N5121.5900' W00018.4190' 27.0 24/07/2005 10:08:05 0 4
    60 15.0


    elyob Guest

  2. #2

    Default Re: Information from a file ...

    elyob wrote: 

    I'd consider using fopen ('filename','R') and fgets().
    If the number of lines per location is fixed a for loop could be the
    easiest bet to read all lines per item.

    If the file is really big, all the data may not fit in an array without
    changing the maxmemory setting.

    Consider xferring all the records into a (mysql) database in that case
    and select subsets from there.

    Schraalhans Guest

  3. #3

    Default Re: Information from a file ...


    "Schraalhans Keukenmeester" <com> wrote in message
    news:42e5047c$0$11074$xs4all.nl... 
    >
    > I'd consider using fopen ('filename','R') and fgets().
    > If the number of lines per location is fixed a for loop could be the
    > easiest bet to read all lines per item.
    >
    > If the file is really big, all the data may not fit in an array without
    > changing the maxmemory setting.
    >
    > Consider xferring all the records into a (mysql) database in that case and
    > select subsets from there.
    >[/ref]

    Thanks, I was looking to see whether there is a cleaner way. Probably
    splitting via regular expressions or so. However, I have taken your
    suggestion and it's running nicely. Fortunately the input file has tags at
    the start of each line which I can use to filter out information I don't
    need.

    Thanks


    elyob Guest

  4. #4

    Default Re: Information from a file ...

    elyob wrote: 
    >>
    >>I'd consider using fopen ('filename','R') and fgets().
    >>If the number of lines per location is fixed a for loop could be the
    >>easiest bet to read all lines per item.
    >>
    >>If the file is really big, all the data may not fit in an array without
    >>changing the maxmemory setting.
    >>
    >>Consider xferring all the records into a (mysql) database in that case and
    >>select subsets from there.
    >>[/ref]
    >
    >
    > Thanks, I was looking to see whether there is a cleaner way. Probably
    > splitting via regular expressions or so. However, I have taken your
    > suggestion and it's running nicely. Fortunately the input file has tags at
    > the start of each line which I can use to filter out information I don't
    > need.
    >
    > Thanks
    >
    >[/ref]
    Regex can be bliss, but complex at times and not always faster than the
    simpler yet brute solution.
    You're welcome of course. Perhaps others DO have a better solution.
    Would not surprise me at all!
    Schraalhans Guest

  5. #5

    Default Re: Information from a file ...

    elyob wrote: 

    Have you considered XML format of the file?
    Kleist Guest

  6. #6

    Default Re: Information from a file ...


    "Kleist" <pl> wrote in message news:dc4ls7$p3t$uar.net... 
    >
    > Have you considered XML format of the file?[/ref]

    There is no XML version of the file as far as I can see.



    elyob Guest

  7. #7

    Default Re: Information from a file ...

    "elyob" <com> : 
    >
    > There is no XML version of the file as far as I can see.[/ref]
    He meant to convert the file to XML for storing purposes.

    However, if you need a reaaly fast and small-space-consuming way, than you
    should write an application ( in C/C++ or better- 'cause i like it most-
    Free Pascal) that uses big buffers (4 kB at least) to read read data and
    store data in Records. Such FP console app would be quite portable (FP
    compiler is available for most platforms) and you could use it in PHP with
    exec('appname'). Compiled programs all faster than scrips.

    Regards,
    Talthen


    Guest

Similar Threads

  1. How to get pdf file page's information
    By fuzezheng@adobeforums.com in forum Adobe Acrobat SDK
    Replies: 4
    Last Post: November 14th, 08:04 AM
  2. help with File Summary Information
    By jorgepino in forum Coldfusion - Advanced Techniques
    Replies: 6
    Last Post: May 5th, 06:20 PM
  3. File Information need to appear on printout
    By catherine_anderson@adobeforums.com in forum Adobe Illustrator Macintosh
    Replies: 2
    Last Post: July 2nd, 11:36 AM
  4. PDF File Information thru PERL
    By Aqua in forum PERL Modules
    Replies: 1
    Last Post: April 5th, 05:05 AM
  5. master information file
    By Rick \Nutcase\ Rogers in forum Windows XP/2000/ME
    Replies: 3
    Last Post: July 6th, 10:44 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139