Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 970
  • Last Modified:

Send GPS data to database

Hi Experts,

I am developing an application that displays the mobile user’s latitude/longitude, speed and direction; but I need to go a few steps further.  I need to find a way to send the latitude, latitude and the unit’s ID to a database.  I need the push to occur every 15-30 seconds “or” 1/8th of a mile, whichever occurs first.  What is the best way to make this happen?  I am new to VB and everything thus far is self taught, with some help from experts such as you.  Please be specific in your answers and I ask for your patience with me if I do not understand everything.

I am developing with Visual Studio 2005, language VB.
0
NCSO
Asked:
NCSO
1 Solution
 
WilliamFrantzCommented:
What is your target device?  A Windows Mobile cell phone?

Generally speaking, you won't be able to do what you envision.  Nearly all phones prohibit access to location information.  Furthermore, most phones do not have a full-fledged GPS receiver in them.  They have half a GPS receiver.  The other half is in some central office of the carrier (Verizon, Cingular, etc.).  Your phone just picks up the GPS signals and sends raw data over the network to the carrier who crunches the numbers to determine your location.  This is "Assisted GPS".

There is probably not enough raw data on the device itself to get a fix without the cooperation of the carrier.

You'll probably have to build your own device using a GPS receiver and a cell phone.  A good choice would be a Pocket PC phone and a Bluetooth GPS receiver.  You could then write some custom software for the phone to accomplish what you want.

Keep in mind that most devices don't have enough battery life to report a fix every 15 seconds.  They will go dead in less than a day.
0
 
WilliamFrantzCommented:
Here's a Garmin Bluetooth receiver:
http://www.garmin.com/products/gps10/

The PPC 6700 is an EVDO, Bluetooth phone that would be a good choice for this project:
http://www.microsoft.com/windowsmobile/articles/ppc6700.mspx

You could alternatively use a laptop with a data card like this:
http://www.novatelwireless.com/products/merlin/merlin-s620.html

0
 
NCSOAuthor Commented:
Thanks for your responses.  I apologize for not being more clear of the current configuration.  All the clients (laptop users) have a GPS antenna and receiver in the cars; and the current application displays the vehicles latitude, longitude and speed.  I need to be able to capture this data every 1/8th of a mile or every 30 seconds, whichever occurs first and store this GPS data in a SQL database table.  This process is required for us to complete an AVL (Automatic Vehicle Location) project here at the Sheriff's Office.  Thanks for you assistance.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
WilliamFrantzCommented:
So you don't need to transmit the location data over-the-air?  You just need to keep a log in a local SQL database on the laptop?

What you need is some custom software for your laptops that grabs GPS data from the serial port(?) and plops it into a database.  Such an application wouldn't be difficult to write.  I see that you already have Visual Basic.

Here's an article about SQL access from Visual Basic:

http://www.adit.co.uk/html/sqlforaccess2.html

Here's a VB example for reading GPS data from an NMEA device:

http://www.developerfusion.co.uk/show/4634/


0
 
NCSOAuthor Commented:
PAQ refund please, I have developed the methodology necessary to accomplish my project needs.  My specific question was how to store the data stream to a database.
0
 
VenabiliCommented:
Sure. Post your solution and you get your points back - this is how EE works.
Because the solution above will work :) And unless you post another one, there is no reason not to give points
0
 
NCSOAuthor Commented:
Per your request!
       
Dim conn As New System.Data.SqlClient.SqlConnection("Connection String Goes Here")
        Dim da As New System.Data.SqlClient.SqlDataAdapter("Select * from [table name]", conn)
        Dim ds As New System.Data.DataSet
        Dim cmd As New SqlCommand("insert into [table name](Latitude,Longitude,speedmph,fixstatus,unitid,username)values(@latitude,@longitude,@speedmph,@fixstatus,@unitid,@username)", conn)

        Try
            conn.Open()
            cmd.Parameters.Add(New SqlParameter("@longitude", SqlDbType.NVarChar = 12)).Value = Longitude.Text
            cmd.Parameters.Add(New SqlParameter("@latitude", SqlDbType.NVarChar = 12)).Value = Latitude.Text
            cmd.Parameters.Add(New SqlParameter("@speedmph", SqlDbType.NVarChar = 12)).Value = SpeedMPH.Text
            cmd.Parameters.Add(New SqlParameter("@fixstatus", SqlDbType.NVarChar = 12)).Value = FixStatus.Text
            cmd.Parameters.Add(New SqlParameter("@unitid", SqlDbType.NVarChar = 12)).Value = UnitID.Text
            cmd.Parameters.Add(New SqlParameter("@username", SqlDbType.NVarChar = 12)).Value = UserName.Text
            cmd.ExecuteNonQuery()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        Finally
            conn.Close()
        End Try
0
 
GranModCommented:
PAQed with points refunded (500)

GranMod
Community Support Moderator
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now