NCSO
asked on
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.
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.
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
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
ASKER
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.
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/
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/
ASKER
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.
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
Because the solution above will work :) And unless you post another one, there is no reason not to give points
ASKER
Per your request!
Dim conn As New System.Data.SqlClient.SqlC onnection( "Connectio n String Goes Here")
Dim da As New System.Data.SqlClient.SqlD ataAdapter ("Select * from [table name]", conn)
Dim ds As New System.Data.DataSet
Dim cmd As New SqlCommand("insert into [table name](Latitude,Longitude,s peedmph,fi xstatus,un itid,usern ame)values (@latitude ,@longitud e,@speedmp h,@fixstat us,@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
Dim conn As New System.Data.SqlClient.SqlC
Dim da As New System.Data.SqlClient.SqlD
Dim ds As New System.Data.DataSet
Dim cmd As New SqlCommand("insert into [table name](Latitude,Longitude,s
Try
conn.Open()
cmd.Parameters.Add(New SqlParameter("@longitude",
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",
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
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
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.