The MP3car.com Store The MP3car.com Store    

Sponsored links

Go Back   MP3Car.com > Mp3Car Technical > Software & Software Development > Coders Corner

Reply
 
LinkBack Thread Tools Display Modes
Old 04-04-2007, 12:57 PM   #1
Newbie
 
Join Date: Jan 2007
Posts: 26
Question about MapPoint and Current Vehicle Location

I am developing my own FE in VB.net using MS MapPoint 2006. Currently, I have an NMEA interpreter that reads from the GPS and displays the Lat/Lon on the screen. I also found a way to add a "pushpin" for the vehicles current location. But I think that there might be a better way to display the vehicle location on the map. I have searched google and these forums to no avail...

Here is the code that I have to show the vehicle location:

Code:
'set map starting point objLoc = objMap.GetLocation(Lat, Lon) Dim objVehicle As MapPoint.Pushpin objVehicle = objMap.AddPushpin(objLoc, "") ' Change pushpin symbol (the one we added for this purpose) objVehicle.Symbol = 336 objLoc.GoTo()

Currently this code works and I pass the Lat/Lon variables from the serial read function. But it appears when I turn on the MP balloons that it is really creating one pushpin ontop of another. Everytime the GPS updates I get a new balloon.

Am I locating the vehicle properly? Any help is greatly appreciated.

Thanks,

Axel
AxelDoomeyer is offline   Reply With Quote
Advertisement
 
Advertisement
Sponsored links

Old 04-05-2007, 09:11 AM   #2
Low Bitrate
 
RickS's Avatar
 
Join Date: Nov 2005
Location: Bethesda, MD
Posts: 86
On every data received event (every time you get new GPS data), you have to delete the old pushpin then create a new one. Move your declaration of objVehicle out of this subroutine so that it's global to the form (so it doesn't get re-declared every time the subroutine runs). and in it's place add objVehicle.delete() to this subroutine. You also need to do a bit of error checking in case objVehicle hasn't been defined/assigned yet...something like this:

If Not objVehicle is nothing then
objVehicle.delete()
End If
RickS is offline   Reply With Quote
Old 04-05-2007, 11:20 AM   #3
Newbie
 
Join Date: Jan 2007
Posts: 26
ahhh.... So I had the right idea just wrong implimentation. I changed my code and it appears that it is working.

You would think that there would be an actuall vehicle location module built into mappoint directly... Oh well...

Thanks,

Axel

Last edited by AxelDoomeyer; 04-05-2007 at 11:23 AM. Reason: Can't Type
AxelDoomeyer is offline   Reply With Quote
Old 04-06-2007, 10:38 AM   #4
Newbie
 
Join Date: Jan 2007
Posts: 26
I have MapPoint building routes but I am a little confused on the directions part. Do I need to rebuild the route everytime the GPS updates the current vehicle location? Or is there a simple way that mappoint knows where the vehicle located?

Thanks,

Axel
AxelDoomeyer is offline   Reply With Quote
Old 04-06-2007, 02:58 PM   #5
Low Bitrate
 
RickS's Avatar
 
Join Date: Nov 2005
Location: Bethesda, MD
Posts: 86
You've found one of the main problems with trying to build a car based, real-time GPS application with MP. MP cannot internally tell you if a location or pushpin is located on a route...you have to do it through educated guessing and error checking to see if your guess was correct.

The following will tell you how much straight line distance is left from your current location (based on CurrentLatitude and CurrentLongitude) to an item in your directions collection (the route). When the distance gets to be less than some threshold you determine (I set it at <0.015), you can increment to the next item in the directions collection and most of the time it'll work.

DistanceToNextAction = objRoute.Directions.Item(CurrentInstructionNumber) .DistanceTo(objMap.GetLocation(CurrentLatitude, CurrentLongitude))
If DistancetoNextAction < 0.015 Then
CurrentInstructionNumber += 1
End If

Sometimes it won't work which is where you have to setup some error checking to see if the distance gets progressively greater from your next direction item (that usually indicates you've got something wrong).

Another thing I started working on, but haven't had a chance to finalize though it should work pretty well, is to get the name of the street you are currently on and iterate through the direction items to get a match. That'll tell you which direction item you are on then you can use the technique above to change to the next direction when you get to the "turn"
RickS is offline   Reply With Quote
Old 04-06-2007, 06:35 PM   #6
Newbie
 
Join Date: Jan 2007
Posts: 26
So basically I am on the right track as far as real time GPS tracking. What it appears is that MP has no internal support for GPS tracking and basically when the GPS updates the LAT and LON I have to rebuild the route using my current location pushpin. And then determine if I am even on the road and run some error checking to make sure.

Whew.... That was a tounge twister.

Is there a GPS emulator that can be used to test this with? That would be alot easier than lugging the laptop to the truck and then trying it...

Thanks for the info...

-Axel

Last edited by AxelDoomeyer; 04-06-2007 at 06:36 PM. Reason: Can't spell
AxelDoomeyer is offline   Reply With Quote
Old 04-15-2007, 02:37 PM   #7
Low Bitrate
 
RickS's Avatar
 
Join Date: Nov 2005
Location: Bethesda, MD
Posts: 86
There is a GPS emulator available but I haven't used it so I can't remember what it's called...checkout the GPS section and/or coders corner...or do some Google searching.

Check these out, looks like some REALLY useful information for what you (and I) are working on...

http://www.mp2kmag.com/a137--gps.api.2006.mappoint.html

http://www.mp2kmag.com/a139--point.i....mappoint.html
RickS is offline   Reply With Quote
Sponsored links
Advertisement
 
Advertisement
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
RR 3-30-05 ... Mappoint ... guino Road Runner 122 04-06-2005 12:47 AM


All times are GMT -5. The time now is 09:04 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
Copyright © 1999 - 2008 Mp3Car.com Inc.Ad Management by RedTyger
Message Board Statistics