ThinkGeo.com    |     Documentation    |     Premium Support

Bug in method GetPointOnALine?

Hello,


I find something really strange. In my original code the method GetPointOnALine in some cases returns a wrong point. I make a code test for document this issue but the result is diferent in the test code??? The result in both cases is wrong. 


Here is the test code:


 



Imports ThinkGeo.MapSuite.Core
Imports ThinkGeo.MapSuite.DesktopEdition

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim omsmlsMLine As MultilineShape
        Dim omspsPoint As PointShape

        omsmlsMLine = New MultilineShape("MULTILINESTRING((660081.58593899 2178301.72641268,660081.598276218 2178308.96236724))")
        omspsPoint = omsmlsMLine.GetPointOnALine(StartingPoint.FirstPoint, 50)

        ' In my original code returns "POINT(660081.58593899 2178301.72641265)" a diferent result from this test code but 
        ' both incorrect ????
        MsgBox("Incorrect middle point calculated: " + omspsPoint.GetWellKnownText() + vbCrLf + _
               "The correct point is: POINT(660081.5921 2178305.344)", MsgBoxStyle.Critical, "Error")

    End Sub
End Class

It is a bug? Am I doing something wrong?



I found other case more strange. But the problem is that it can not be replicable via the WellKnownText, becouse in this way the result is ok. But I send you the results that I have in the command window when I was debuging.



>? omsmlsEje.GetWellKnownText()


"MULTILINESTRING((660858.341603156 2178891.39187658,660826.776988299 2178770.71526703,660800.705646911 2178648.73389893))"


>? omsmlsEje.GetPointOnALine(StartingPoint.FirstPoint, 50).GetWellKnownText()


"POINT(660858.341603156 2178891.39187658)"



It's returning the first point?? but why if I use the WKT to create again the shape works fine??



Yuri, 
  
 Thanks for your reporting! This is a bug in MapSuite Core, I have added this to our working system, and hopefully it will be fixed in next version. 
  
 If you want to get the center point, please use the GetCenterPoint instead. 
  
 Thanks. 
  
 Yale 


I also ran into this problem.  I'm trying to get a point 100 meters from the start of the line.  Will this fix make it into the next release and, if so, when?


Thanks



Yuri and David, 
  
 We will release a new version next Monday in which the problem has been solved, just wait a couple days and try. 
  
 Thanks, 
  
 Ben