| | Anonymous 01-10-2005, 02:49 AM Hi
I have just found that this error is thrown also when :
I have 2 coordinates :
p1(lat1,long1)
p2(lat2,long2)
When we add the 2 points on a map, here are the possible errors :
(E1) IF lat1==lat2 AND long1==long2 THEN ERROR 4-40028-1
(E2) IF lat1==lat2 AND long1<>long2 THEN ERROR 4-40028-1
The second case (E2) is very problematic to me because we have an application tracking vehicles and sometimes between 2 coordinates the latitude is the same but not the longitude...
To me it's a bug... What do you think of this ? Wilfried 01-10-2005, 03:16 AM Hi,
Just putted 2 pushpin on map with same latitude and different longitude. Then connected them with an arrow. No exception, no error...
Where comes this error out ? Can you demonstrate the behavour with a few lines of code ? Anonymous 01-10-2005, 04:50 AM Hi
Do you use MapPoint 2002 ?
With my version of MapPoint Europe 2002, I have a list of coodinates. In this list there is the following points :
LAT[0x17] = 48.4537363 LONG[0x17] = 2.0505554
LAT[0x18] = 48.4537359 LONG[0x18] = 2.0505554
Here's the drawing source code :
The error seems to happen in the "zoomout" functions. Also, I tried to cancel the zoomout functions but the error still happens. When I remove the 2 GPS coordinates LAT[0x17] LONG[0x17] and LAT[0x18] LONG[0x18] the error does not happen...
private void TraceTrackPoints()
{
try
{
// Gets a reference on the mappoint 2002 control
MapPoint.Map mpmap = this.axMappointControl1.ActiveMap;
// Geocodes all the points in array, and links them with a line shape
int i=0;
while ( (g_dLat[i] != -1) && (g_dLong[i] != -1) )
{
mpmap = this.axMappointControl1.ActiveMap;
mploc[i] = mpmap.GetLocation(g_dLat[i], g_dLong[i], 1);
if(i==0) mploc[i].GoTo(); // zoom on start point
MapPoint.Shape sh = null;
if(i>0)
{
sh = mpmap.Shapes.AddLine(mploc[i-1], mploc[i]);
sh.Line.Weight= 1;
}
MapPoint.Pushpin pp = null;
if (i==0)
pp = mpmap.AddPushpin(mploc[i], "START");
else
pp = mpmap.AddPushpin(mploc[i], "");
pp.Symbol = 83;
i++;
}
mpmap.ZoomOut();
mpmap.ZoomOut();
}
catch(Exception)
{
MessageBox.Show("ERROR", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
thanks Wilfried 01-10-2005, 05:03 AM Hi,
Probably the reason I dont have the error. I use MP 2004 at the moment. I have MP 2002 also but the machine where it is on is at the moment defective motherboard. Should be repaired next week.
I will try this when I have again access to that machine. In case I forget please send me ar reply to remind me :) Anonymous 01-10-2005, 05:07 AM LAT[0x17] = 48.4537363 LONG[0x17] = 2.0505554
LAT[0x18] = 48.4537359 LONG[0x18] = 2.0505554
I have just traced my application in debug mode in VS.NET C# 2003 and the error is throw on the following line, for LAT[0x18] and LONG[0x18]
sh.Line.Weight= 1;
I'm sure at 99% that the error is due to the similar longitudes... Let me know if you can reproduce the same case :)
thanks Wilfried 01-10-2005, 05:11 AM I'm sure at 99% that the error is due to the similar longitudes... Let me know if you can reproduce the same case
yes. and please remind me if I did not do it in next week ;) Anonymous 01-10-2005, 06:35 AM Okay, thank you for your investigation :) Wilfried 01-10-2005, 08:09 AM Hi,
Just thinging on something what could be a workaround. What if you compare both latitudes, and if they are equal increment 1 by 0.00005 ?
This is around 5.5 meter difference. Maybe even a smaller increment is oK to not get the error again ? Winwaed 01-10-2005, 08:26 AM As an aside, Wilfried, you can run MapPoint 2002 and 2004 on the same machine. The only problem is if you have an executable that accesses MapPoint as a COM object - then it will always default to 2004 even if you explicitly give the 2002 version number.
This PC here has three versions of MapPoint installed, and the fourth is currently in the mail :-)
Richard brianmcg 01-10-2005, 01:48 PM I seem to remember that I would run into a problem when adding a zero-length line (Lat1=Lat2 and Long1=Long2) in Mappoint 2002 (programming in VB6), but I have no way to test that now. Your two points are virtually on top of one another. Could that be your issue here? Yes, that's exactly the problem I"m facing... If the coordinates are the same, or if one of them are the same, then there's an error.
I had thought of adding a little value, as said Wilfried, but I've not tried yet... But I think this is a "hacking" way, and we must be the more precise we could :) ... Anyway if this is the only solution then we'll use it !! brianmcg 01-11-2005, 09:25 AM I worked around the problem by testing the new point before adding the line and only using the new point if it was different (by some preset limit) from the previous point. I don't know if ignoring or bypassing some points is an option in the application, but it worked for me. Yes Brian, that's what I'm actually doing...
I think it's not problematic when lat1==lat2 AND long1==long2
But I think this is problematic when
lat1<>lat2 AND long1==long2
or
lat1==lat2 AND long1<>long2
Because in the case where the tracked GPS (for example) stays on the same latitude or the same longitude for a little period of time... | |