This project has moved and is read-only. For the latest updates, please go here.

Mouse World Pos question

Topics: Algorithms, SharpMap v0.9 / v1.x, WinForms Controls
Jan 16, 2008 at 11:54 AM
I am very new to SM, i have what maybe a very silly question!

I have the following code

Private Sub MapBox_MouseMove(ByVal WorldPos As SharpMap.Geometries.Point, ImagePos As System.Windows.Forms.MouseEventArgs)
If map IsNot Nothing Then
Me.tslText.Text = (worldpos).ToString
Me.tslText.Text = Me.tslText.Text & " || " & map.ImageToWorld(New PointF (imagePos.X,ImagePos.Y)).ToString
End If
End Sub

If I locate my mouse near to the map center (for example) i get the following,
POINT (6.3 -3.5) || POINT (-0.6633663366337 0.25346495373417)

whats going on with the worldpos? - am i making some basic mistake?

SM v 0.9


Jan 16, 2008 at 3:57 PM
Hi Ross -


This might help you: Transforming between image coordinates and world coordinates.

Jan 17, 2008 at 4:29 PM
Hi Codekaizen,
Thanks for the link, it din't quite work, but i got to the page ok. I kinda understand converting between system and world co-ords,

I guess what I'm getting at is why worldpos, from the mosue move event of the MapImage control, does not give the correct lat long positions - I have been playing around with the control and found it to be a bit dodge in general? I think i might just go back to using a picture box. for example the pan and zoom functions don't seem to work properly.
Jan 17, 2008 at 5:01 PM
@ross -

Ah, I see, you are using the MapBox control. I haven't used it myself, but I've heard a lot of positive reviews of it.

You're sure that your data is in Lat/Lon? What does the Map object say that the extents are?