PDA

View Full Version : Adding a PushPin from a Long/Lat position



zadic
10-03-2005, 02:43 AM
Hi all

Background: I have vehicles in the field and they report their long,lat positions to a sqlDatabase through GPRS.

What I want to know is how do I use this long/lat positions to add a pushpin or any type of shape onto my map?

Im not using the webservice put the MappointControl object with a VB form.

Thanx

Z

calv1ns
10-05-2005, 11:58 AM
Zadic

Here is a VB6 Funciton that will do what you want:



Public Function addpushpin(wk_lat As Double, wk_long As Double, wk_type As Integer, wk_name As String) As Integer
Dim this_loc As MapPoint.Location
Dim this_pin As MapPoint.Pushpin
'note myobj is a global definded as Dim myobj as MapPoint.Map
'Function: addpushpin returns +1 on success -1 on failure

myapp.Visible = True

On Error GoTo myErr:
wk_istat = 1
Set this_loc = myobj.GetLocation(wk_lat, wk_long, 0)
Set this_pin = myobj.addpushpin(this_loc, wk_name)
this_pin.Symbol = wk_type

myErr:
If Err.Number <> 0 Then
On Error GoTo 0
Debug.Print Err.Number, Err.Description
Err.Clear
wk_istat = -1
End If
addpushpin = wk_istat
End Function


Ciao,

zadic
10-06-2005, 12:33 PM
Thanx it worked!!

Zadic