PDA

View Full Version : addpushpin problem



Anonymous
09-17-2002, 04:49 PM
I'm writing a program where a history of tractors can be plotted on the map.
Everything goes fine, except for one error i keep having.
When adding pushpin, sometimes I get the error :"Run-time error '-2147467259(80004005)':

Method 'AddPushpin' of object '_Map' failed"

I must say, when plotting the history, sometimes more then 1000 pushpins have to be added, but this should not be a problem for mappoint i think, or am i wrong?

What i basicly do is:
-get the positions into a collection of "position" object
(position --> lat, lon, date, name...)
-loop through the collection, and add each position to the Pushpinset

can somebody help me??

thx in advance

John Meyer
09-18-2002, 02:12 PM
is it possible that one of your "MapPointCtl.Location' that you are looping thru is nothing? is it random or does it stop on the same location each time?

Without seeing the real code its kinda hard to debug, not sure what type of error checking you might already have.

Joeba
09-18-2002, 05:08 PM
It's a random problem, so it has nothing to do with the location object i think(always has a correct value).
I also get the folowing runtime error from mappoint itself:
"R6025
-pure virtual function call"

So my guess was that the addpushpins were folowing eachother to quick, and that mappoint couldn't handle them all.
So I reduced the amount of loops, from about 1000 to 200, and repeated this several times, worked good.

Then I did the same, but started all sorts of programs during the process, and guess what, same error.

So it has something to do with not enough memory or something like that.

Is there a better way of plotting positions?
what i do is:
-get all positions
-loop all these positions and add a pushpin for each location

Ideal would be if i could just have a collection of locations, and plot this collection, but don't know if this is possible.

Any suggestions are welcome :)

tnx

John Meyer
09-18-2002, 08:12 PM
How about the Data Import Wizard, either put your data in excel or access. Something to try, would be intresting to see if that worked better or not.

Joeba
09-19-2002, 01:03 PM
Also thought of trying that, but i didn't like the idea of giving all control to mappoint, if i added the pushpins "manualy", then i could make a nice progressbar etc...

but tried it anyways, and idd, you were right, plotting the pushpins is much faster!

the only problem now is that my nice progress bar is no more :p
or is there a way of detecting what mappoint is doing, busy plotting pushpins or something like that...

tnx for the help, will try to implement it this way

Greetz Joeba

Anonymous
09-19-2002, 05:20 PM
Bad news first: I do not have a solution for your problem.

Then good news: I get the same error when adding pushpins of my locations programatically. It is an intermitent problem. I load the same data all the time. The error does not happen at the same data point. The error correspond to an automation error (according to hitting F1 in the VB developemnt HELP)


Vic

Gryffyn
07-14-2004, 04:42 PM
Anyone ever find a solution to this problem?

I have an Excel VBA script that gets a list of origin/destination airports for the truckers we manage and I'm trying to plot pushpins for the trucks. I'm scavenging another script I have that works fine (except one other weird issue that seems timing related) so I'm a little baffled.

It plots the first pushpin ok on ORD (Chicago) then goes to plot one on LAX (Los Angeles) and it blows up.

I'm getting a location object by doing:

Set objORGLoc = objMap.FindPlaceResults(org)(1)

Where "org" was "ORD" first, then "LAX".


Sub plot_it(ByRef objMap, ByRef org, ByRef pushpin_desc, ByRef pushpin_note, ByRef pushpin_symbol)

Set objORGLoc = objMap.FindPlaceResults(org)(1)

Dim objPushpin As MapPoint.Pushpin

Set objPushpin = objMap.AddPushpin(objORGLoc, pushpin_desc)
objPushpin.Note = pushpin_note
objPushpin.Symbol = pushpin_symbol

show_balloons = True

If show_balloons Then objPushpin.BalloonState = geoDisplayBalloon

End Sub

Excuse the bad programming form here and there.

I originally had that FindPlaceResults outside the plot_it sub and passed in the object and it worked fine. I just put it in there and passed just the "org" value to see if that helped. Guess not.


Same run-time error though. AddPushpin failed. Same numbers, etc.

Any help is appreciated. Thanks!

-TG

Gryffyn
07-14-2004, 04:43 PM
Anyone ever find a solution to this problem?

I have an Excel VBA script that gets a list of origin/destination airports for the truckers we manage and I'm trying to plot pushpins for the trucks. I'm scavenging another script I have that works fine (except one other weird issue that seems timing related) so I'm a little baffled.

It plots the first pushpin ok on ORD (Chicago) then goes to plot one on LAX (Los Angeles) and it blows up.

I'm getting a location object by doing:

Set objORGLoc = objMap.FindPlaceResults(org)(1)

Where "org" was "ORD" first, then "LAX".


Sub plot_it(ByRef objMap, ByRef org, ByRef pushpin_desc, ByRef pushpin_note, ByRef pushpin_symbol)

Set objORGLoc = objMap.FindPlaceResults(org)(1)

Dim objPushpin As MapPoint.Pushpin

Set objPushpin = objMap.AddPushpin(objORGLoc, pushpin_desc)
objPushpin.Note = pushpin_note
objPushpin.Symbol = pushpin_symbol

show_balloons = True

If show_balloons Then objPushpin.BalloonState = geoDisplayBalloon

End Sub

Excuse the bad programming form here and there.

I originally had that FindPlaceResults outside the plot_it sub and passed in the object and it worked fine. I just put it in there and passed just the "org" value to see if that helped. Guess not.


Same run-time error though. AddPushpin failed. Same numbers, etc.

Any help is appreciated. Thanks!

-TG

John Meyer
07-16-2004, 09:05 AM
I tried this code and it works ok (not an issue with "lax"). If it is a timing issue maybe try testing via ReadyStateChange event to make sure the mappoint control is not busy?


Dim objmap As MapPoint.Map
Set objmap = MappointControl1.ActiveMap
Set objORGLoc = objmap.FindPlaceResults("lax")(1)

Dim objPushpin As MapPointctl.Pushpin
Set objPushpin = objmap.AddPushpin(objORGLoc, "test")

Anonymous
09-28-2004, 09:12 AM
I had the same problem when I added a pushpin. It was caused by inadvertently trying to add a pushpin with the same name as one already used. Used a unique name and the problem disappeared Mappoint happily added over 3000 pushpins with 80 different symbols
Hope this helps
Steve