Adding Pushpin

Anonymous
03-09-2005, 11:04 AM
Hello Everybody,
I am new to mappoint. I have an existing VB6 application and trying to integrate mappoint with it so that user can have an option of viewing the structures in mappoint. So if user click on View map button, a map should popup with some pushpins on specified latitude and longitude. Each pushpin should display information regarding the structure pushpin is representing. Also I want to control the zoom option so that it dont expand beyond florida state.

I have installed mappoint on my machine and run few simple examples from mappoint help. I would really appreciate if you can point me to some good resources.

Thanks

Wilfried
03-09-2005, 03:01 PM
Hi,

You dont ask a question, so it is difficult to answer. Please ask what you need help for.

Anonymous
03-10-2005, 03:21 PM
Thanks Wilfried for responding to my post. I was just going through the sample example of mappoint uptil now and was tryign to figure out how to use it for my application. So far everything worked as supposed.

But now I am having a doubt. What I am trying to do is plotting pushpins on north america map for different lattitude and longitude which is based on users input. the problem is if I am plotting only one pushpins everythign is working fine but when I am trying to iterate through a collection and addign the pushpins i dont know somehow its adding the pushpin in atlantic ocean but it shuld ass somewhere in florida state.

Here is the code I am using:
Option Explicit
Public mColStructure As colStructures
Dim objStruct As CStructure
Public oMap As mappointctl.Map
Dim objLoc As MapPoint.Location
Dim objPin As MapPoint.Pushpin
Dim strPushpinSetName As String
Dim objDS As MapPoint.DataSet
Dim objDataSet As MapPoint.DataSet
Dim strNote As String

Private Sub Command1_Click()
Unload Me
Set frmPlotStructures = Nothing
End Sub

Private Sub Form_Load()

MappointControl1.NewMap (geoMapNorthAmerica)
Set oMap = MappointControl1.ActiveMap

'Get rid of any previous results, but not my reference pushpin.
For Each objDataSet In oMap.DataSets
If Not objDataSet.Name = "My Pushpins" Then
objDataSet.Delete
End If
Next

'Create a new pushpin set.
strPushpinSetName = "test"

oMap.DataSets.AddPushpinSet strPushpinSetName
Set objDS = oMap.DataSets(strPushpinSetName)
objDS.Select


For Each objStruct In mColStructure

'Get the location of the structure based on its latitude and longitude.
Set objLoc = oMap.GetLocation(objStruct.Latitude, objStruct.Longitude)
'Set objLoc = oMap.GetLocation(30.4015891666667, -83.3612477777778)

'Add a Pushpin to the map at this location
Set objPin = oMap.AddPushpin(objLoc, objStruct.ID)

objPin.BalloonState = geoDisplayNone
objPin.Symbol = 110
strNote = "one" & vbCrLf & _
"two" & vbCrLf & _
"three" & vbCrLf & _
"four"
objPin.Note = strNote
objPin.Cut
objDS.Paste

Next


'Zoom to the newly created Pushpin set
oMap.DataSets.ZoomTo
End Sub


I'll appreciate any kind of input.
Thanks

Wilfried
03-10-2005, 03:46 PM
Hi,

there is no difference in adding 1 pushpin or adding one thousand of it. So you must have a problem in your code. Your listing does not give me a direct probllem but I'm not used to VB. Go carefully troiugh the debugger to find the line where the position is in the ocean..Sorry cannot give more advice...

Anonymous
03-10-2005, 03:53 PM
Thanks for quick reply Wilfried. I realized the latitude and longitude value in structure was null because of which it was plotting pushpins in the atlantic ocean.

I have one more quoestion is it possible to control the zoom level i.e I dont want the map to zoo beyond florida map.

Also I am adding information relating to each structure in the pushpins note object. Is there any way to disable the editing of that note from map.

Thanks in advance

Wilfried
03-11-2005, 07:23 AM
Hi,

with these you control zoom and zoom + position:

MP.ActiveMap.Altitude = Alt;
MP.ActiveMap.GotoLatLong(Lat, Lon, Alt);

I dont think you can prevent the user to edit the note. But as always there are workarounds. In BeforeClick event you can disable popup menu from Mappoint, but of course the user cannot do mutch other. Instead you can there display your own popup menu with the functions you want. However not all functions are accesible. A workaround for this is to send keystrokes to the map. Very receint there was a post about that. I think subject was 'undocumented things' or something.

 
Web mp2kmag.com
mapforums.com