Community of VE/MapPoint Users and Developers
This is a discussion on How to continuosly add a GPS pushpin on MP2006? within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi everyone: I have to say Thank you!!!! for the wealth of information everyone on this post is sharing about ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| Hi everyone: I have to say Thank you!!!! for the wealth of information everyone on this post is sharing about mappoint. Information which for the most part, is not found anywhere else. I am using vb6 and mp2006, and I am also new to programming. ---- Problem: I do not know how to continually display the lat/lot information coming from my GPS. I have two "Public" variables one for latitude (lat) and another one for longitude (lot) which are constantly receiving the already parsed lat/lot coordinates from the GPS, but the GetLocation method allows me to place only one pushpin on on the map. (See the last procedure below) What code do I use to place one pushpin every 1 or 2 seconds on the map based on the lat/lot info from the GPS? code below: -------------------------------------------------------------------------- Public lat As Double Public lon As Double Private Sub Form_Load() Dim objMap As MapPointCtl.map Set objMap = MappointControl1.NewMap(geoMapNorthAmerica) Set objMap = MappointControl1.ActiveMap call position_gps End Sub Private Sub form_unload(cancel As Integer) MappointControl1.ActiveMap.Saved = True End Sub Private Sub position_gps() Dim mymap As MapPointCtl.map Dim myLoc As MapPointCtl.Location Dim mypushpin As MapPointCtl.Pushpin Set mymap = MappointControl1.ActiveMap Set myLoc = mymap.GetLocation(lat, lon) Set mypushpin = mymap.AddPushpin(myLoc) mypushpin.Symbol = 83 mypushpin.Location.GoTo End Sub -------------------------------------------------------------------------- There is one or two similar threads, but no code is posted on the solution to this question. |
| |||
| Re: How to continuosly add a GPS pushpin on MP2006?
Hi Joseph, If you're trying to create a trail, "every one or two seconds" isn't even useful. Besides, the refreshing of the screen will be continuous - you see no changes until the screen is 'at rest.' If you're only trying to track a vehicle, declare a variable as PushPin and then change the location of the pin instead of adding new ones. Mike Mattys |
| |||
| Re: How to continuosly add a GPS pushpin on MP2006?
Hi Joseph, Sorry, workday ... I believe I'd just do this: [Aircode] Set myLoc = mymap.GetLocation(lat, lon) Set mypushpin.location = myLoc.location Mike Mattys |
| |||
| Re: How to continuosly add a GPS pushpin on MP2006?
Mike: The code is still not compiling properly, I am getting a "variable not set" error. The object.location property seems to be the way to do it, but something I am doing is obviously wrong. Just like you suggested, the "Programming Mappoint in .NET" book has a section which describes this process in C# , and although the code is different to VB6 the steps are similar: currPushpin.Location = myloc; (in C#) This is where the pushpin is supposed to keep updating its location from the myloc variable. If I use the code you suggested: Set myLoc = mymap.GetLocation(lat, lon) Set mypushpin.location = myLoc.location without adding the pushpin first with ...AddPushpin(myloc) I get a "variable not set" error. If I use the following code: Set myLoc = mymap.GetLocation(lat, lon) Set mypushpin = mymap.AddPushpin(myLoc) Set mypushpin.location = myLoc.location I do not think it is correct to set a variable twice like that; therefore, the code does not produce the desired outcome. It just adds the pin, but no update. Thank you again for your time and ideas. If you can think of any other way to fix this problem, any other suggestion is always welcome. Joseph. |
| |||
| Re: How to continuosly add a GPS pushpin on MP2006?
Let's say you have a menu item by the name of mnuExample This will demonstrate how to continuously move your pushpin. Private Sub mnuExample_Click(Index As Integer) Dim MyMap As MapPoint.Map Dim MyPin As MapPoint.Pushpin Dim MyLoc As MapPoint.Location Dim iloc As Long Dim dlat As Double, dlon As Double dlat = 43.223 dlon = -77.573 Set MyMap = MapCtl.Object.ActiveMap Set MyLoc = MyMap.GetLocation(dlat, dlon, 1) Set MyPin = MyMap.AddPushpin(MyLoc) MyPin.Location.GoTo For iloc = 0 To 200 Set MyPin.Location = MyMap.GetLocation(dlat, dlon, 1) dlat = dlat + iloc / 1000 dlon = dlon + iloc / 1000 Set MyLoc = MyMap.GetLocation(dlat, dlon, 1) MyPin.Location.GoTo Next Set MyLoc = Nothing Set MyMap = Nothing End Sub Mike Mattys |
![]() |
| Tags |
| add, continuosly, gps, mp2006, pushpin |
| ||||
| Posted By | For | Type | Date | |
| Programming MapPoint via .NET - MapPoint Articles - MP2K Magazine | This thread | Refback | 10-22-2007 08:17 AM | |
| Untitled document | This thread | Pingback | 10-22-2007 01:08 AM | |
| How to continuosly add a GPS pushpin on MP2006? | TheGPSBlog.info | This thread | Pingback | 10-20-2007 11:10 PM | |
| MapPoint Forums - MapPoint 2006, MWS, and Virtual Earth Discussion | This thread | Refback | 10-20-2007 04:22 PM | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| can i use mp2006 locally | salmap | Development | 2 | 10-16-2007 02:12 PM |
| MP2006 - C# - Very SLOW closing map | pcfountain | Development | 1 | 05-22-2007 11:44 AM |
| Add-in / MP2006 Memory Clash? | Winwaed | MapPoint 2006/2009 Discussion | 0 | 11-27-2006 05:00 PM |
| MP2006 backward compatibility | Wilfried | MapPoint 2006/2009 Discussion | 1 | 09-08-2006 03:10 AM |
Flights from Stansted
Book cheap flights from Stansted Airport online at Holiday Hypermarket. Use our simple online booking form to take advantage of all the airport facilities
Travel Counselors
Travel Counselors are an award winning Travel Agent. Why not have a personal Travel Counselor help with your travel plans.
Cheap Holidays to Turkey
If you’re looking for cheap holidays to Turkey then dealchecker.co.uk is the place for you! Our search helps you see real prices from the UK’s top holiday companies all in one go.
Holidays to St Lucia
Holidays to St Lucia will leave you smiling. The spectacular scenery and the warmth of the locals make holidays to St Lucia unforgettable.
Balearics
Before booking to the Balearics Islands make sure you check out our travel guide online. The Balearics are renowned for their vibrant nightlife but there are also some stunning Gothic cathedrals, Stone Age ruins and fishing villages.
Cheap Travel
Travel.co.uk has some excellent offers on cheap travel. Click here.
Holidays in Gran Canaria
Have some fun in the sun on the Canary Islands! See On The Beach for information on holidays in Gran Canaria.