[OSM-dev] Problem with osmfilter.pl: NMEA RMC sentences not correctly handled

Francisco R. Santos frsantos at gmail.com
Fri Jan 12 10:02:17 GMT 2007


Thanks for the patch Joerg. However, I had to modify it to add the "|RMC" in
the second if.

Now it works with 11 fields RMC sentences (although it does nothing with the
"Mode indicator" field, whatever it was):

Index: NMEA.pm
===================================================================
--- NMEA.pm     (revisión: 1886)
+++ NMEA.pm     (copia de trabajo)
@@ -107,9 +107,13 @@
            GLL => 5,
            ZDA => 5,
            };
-       if ( $type !~ m/GSV|GSA/ && $elem_count != $elem_soll->{$type} ){
+
+       if ( $type =~ m/RMC/ && ( $elem_count != 10 ) && ( $elem_count != 11
) ){
            print "!!!!!!! ERROR $elem_count is wrong Number of
elements(should be $elem_soll->{$type}): $full_line\n";
            next;
+       } elsif ( $type !~ m/GSV|GSA|RMC/ && $elem_count !=
$elem_soll->{$type} ){
+           print "!!!!!!! ERROR $elem_count is wrong Number of
elements(should be $elem_soll->{$type}): $full_line\n";
+           next;
        }



On 1/11/07, Joerg Ostertag (OSM Munich/Germany) <openstreetmap at ostertag.name>
wrote:
>
> On Thursday 11 January 2007 18:18, Francisco R. Santos wrote:
> > I'm testing the osmfilter.pl script with some NMEA files, but I get a
> bunch
> > of errors with:
> >
> > ...
> > !!!!!!! ERROR 11 is wrong Number of elements(should be 10): $GPRMC,
> > 143857.000,A,4025.5097,N,00336.6222,W,16.97,95.72 ,071206,,,A*78
> > !!!!!!! ERROR 11 is wrong Number of elements(should be 10): $GPRMC,
> > 143858.000,A,4025.5094,N,00336.6162,W,15.47,94.74,071206,,,A*7A
> > !!!!!!! ERROR 11 is wrong Number of elements(should be 10): $GPRMC,
> > 143859.000 ,A,4025.5092,N,00336.6107,W,14.88,95.60,071206,,,A*78
> > !!!!!!! ERROR 11 is wrong Number of elements(should be 10): $GPRMC,
> > 143900.000,A,4025.5093,N,00336.6051,W,15.24,93.58,071206,,,A*7C
> > !!!!!!! ERROR 11 is wrong Number of elements(should be 10): $GPRMC,
> > 143901.000,A,4025.5094,N,00336.5992,W,16.07,90.44,071206,,,A*73
> > ...
> >
> > Although I get the .gpx and .osm files with right data, it seems
> (according
> > to http://www.werple.net.au/~gnb/gps/nmea.html#gprmc
> > <http://www.werple.net.au/%7Egnb/gps/nmea.html#gprmc>) that the new
> "Mode
> > indicator" field is not handled by the script.
> >
> > Can I still use the generated .gpx and .osm files? Are RMC sentences
> used?
>
> In this Version all your RMC lines will be ignored.
> But all othere lines are still read.
>
> If you want to patch it:
>
> Index: NMEA.pm
> ===================================================================
> --- NMEA.pm     (Revision 1863)
> +++ NMEA.pm     (Arbeitskopie)
> @@ -107,9 +107,13 @@
>             GLL => 5,
>             ZDA => 5,
>             };
> -       if ( $type !~ m/GSV|GSA/ && $elem_count != $elem_soll->{$type} ){
> +
> +       if ( $type =~ m/RMC/ && ( $elem_count != 10 ) && ( $elem_count !=
> 11 ) ){
>             print "!!!!!!! ERROR $elem_count is wrong Number of
> elements(should be $elem_soll->{$type}): $full_line\n";
>             next;
> +       } elsif ( $type !~ m/GSV|GSA/ && $elem_count !=
> $elem_soll->{$type} ){
> +           print "!!!!!!! ERROR $elem_count is wrong Number of
> elements(should be $elem_soll->{$type}): $full_line\n";
> +           next;
>         }
>
>
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20070112/fbfb4753/attachment.html>


More information about the dev mailing list