I have an array with 3 columns and 100 rows. The first column is name, 2nd is latitude and 3rd is longitude.
I want to add pushpins to a map, with locations as above. How am I supposed to do that? Coding is in Visual Basic.
Monique
This is a discussion on AddPushpin within the MapPoint Desktop Discussion forums, part of the Map Forums category; I have an array with 3 columns and 100 rows. The first column is name, 2nd is latitude and 3rd ...
I have an array with 3 columns and 100 rows. The first column is name, 2nd is latitude and 3rd is longitude.
I want to add pushpins to a map, with locations as above. How am I supposed to do that? Coding is in Visual Basic.
Monique
Regards,
Monique
Here is a little sample code that might help get you started. I'm using the Mappoint ActiveX control named MPC on my VB form. I'm creating a new map but you could get the activemap insted. Hope it helps.
Dim arrData(99, 3) As String
arrData(0, 0) = "BWI"
arrData(0, 1) = 39.103
arrData(0, 2) = -76.401
arrData(1, 0) = "Duluth"
arrData(1, 1) = 46.5033
arrData(1, 2) = -92.1125
Dim objmap As MapPointCtl.Map
Set objmap = MPC.NewMap(geoMapNorthAmerica)
For i = 0 To 99
If arrData(i, 0) = "" Then Exit Sub
Set objLoc = MPC.ActiveMap.GetLocation(arrData(i, 1), arrData(i, 2), 1000)
Set objPushpin = objmap.AddPushpin(objLoc, arrData(i, 0))
objPushpin.BalloonState = geoDisplayName
Next
John
http://www.support-pc.com
Order MapPoint 2006 Here
https://secure.mp2kmag.com/?refer=support-PC
Instead of using a 3 column array i think it would be easy if you created your own datatype and declare an array of your datatype and fill your data in it. For example
1) create your own data type
Type MPType
Latitude as double
Longitude as double
Name as string
end type
2) declare it
dim x(100) as MPType
3) Fill it with your data
x(0).Latitude=33.567
x(0).Longitude=33.567
x(0).Name="example"
4)find the locations and add a pushpins
dim g_oApp as MapPoint.Application
dim ppin as pushpin
dim L as location
dim i as integer
while(i<100)
Set L = g_oApp.ActiveMap.GetLocation(x(i).Latitude, x(i).Longitude)
Set ppin = g_oApp.ActiveMap.AddPushpin(L,x(i).Name)
ppin.Symbol = g_oApp.ActiveMap.Symbols(2)
i=i+1
wend
These code samples of you, John and Amanuel, will help me out!
Greetings,
Monique Vrolijk
Regards,
Monique
There are currently 1 users browsing this thread. (0 members and 1 guests)