Home > Back-end >  GPS data $GPRMC how to parse, put the longitude and latitude in mysql database
GPS data $GPRMC how to parse, put the longitude and latitude in mysql database

Time:10-18

The whole system is that the GPS GPS/GPRS module to send information to the server, I use c + + write a program to receive information, this is part of the code
If ((nbSize=recvfrom (sockListener cRecvBuff, 800, 0,
(SOCKADDR FAR *) & amp; SaClient, & amp; NSize))==SOCKET_ERROR)//if receive failure indicates that error
{
Printf (" Recive the Error ");
break;
}
CRecvBuff [nbSize]='\ 0';//string terminated
Printf (" % s \ n ", cRecvBuff);
Information in the crecvbuff now, how to extract data,?????? And will he sent to a database that?? Strives for the code!!!!!!
This is the format GPRMC
$GPRMC, & lt; 1> ,<2> ,<3> ,<4> ,<5> ,<6 & gt; ,<7 & gt; ,<8 & gt; ,<9 & gt; ,<10 & gt; ,<11 & gt; ,<12 & gt; * hh
<1> UTC time, HHMMSS format (minutes)//is there ms,
<2> Positioning, effective positioning, A=V=invalid positioning
<3> Degree of latitude DDMM. MMMM (points) format (0 will be ahead of the transfer)
<4> N latitude hemisphere (northern hemisphere) or S (southern)
<5> Longitude DDDMM. MMMM (c) format (0 will be in front of transport)
<6 & gt; E longitude hemisphere (east longitude) or W (n)
<7 & gt; Ground rate (000.0 ~ 999.9, 0 will be in front of transport)
<8 & gt; Surface course (000.0 ~ 359.9 degrees, in true north, for reference benchmark, 0 will be in front of transport)
<9 & gt; UTC date ddmmyy format (the sun)
<10 & gt; Magnetic declination (000.0 ~ 180.0 degrees, the previous 0 will be transport)
<11 & gt; The direction of the magnetic declination, E (east)/W (west)
<12 & gt; Pattern instructions (NMEA0183 only version 3.00 output, A=independent positioning, D=difference, E=estimation, N=invalid data)
Ex. :
  • Related