0

Hello, i am trying to plot X,Y coordinate of a location on a map used in a pictureBox in a windows form using vb.net 2008. when i use the complete UTM grid and load it in the Picturebox, the coordinate plots correctly, but when i use a portion of the map, say Indian Map, the Coordinate point is not plotted correctly. the x,y coordinates of (0,0) is the centre of the picturebox.

for example if i plot (New Delhi, India) in the complete grid, it plots correctly, but when i use a portion of the map, and plot 28.66 , 77.22 it plots somewhere else.. how do i proceed further to plot on sized maps i need help with the problem?

Sub mapcoords(ByVal latitude As Double, ByVal longitude As Double)

    Dim pbwidth As Double = PictureBox1.Width
    Dim pbheight As Double = PictureBox1.Height
    Dim latratio As Double = pbheight / 180
    Dim longratio As Double = pbwidth / 360
    Dim latcord As Double = 90 - latitude
    Dim longcord As Double = (180 + longitude)
    Dim Pen1 As New Pen(Color.Red, 3)
    Dim Pen11 As New Pen(Color.Red, 3)
    Dim g As Graphics = PictureBox1.CreateGraphics
    latcord = latratio * latcord
    longcord = longratio * longcord
    g.DrawEllipse(Pen1, CInt(longcord) - 1, CInt(latcord) - 1, 3, 3)
End Sub

on button click, the following code runs

        Dim coords() As String = TextBox1.Text.Split(",")


    mapcoords(coords(0), coords(1))
3
Contributors
4
Replies
17
Views
2 Years
Discussion Span
Last Post by Mr.M
0

If I understand you correctly, you need to offset the coordinates you want by the coordinates of the top left corner, since that is your new 0,0 point.

0

Hi Tinstaafl, thank you for a prompt reply..

mouse coordinates (0,0) of the screen are the top left corner of the Monitor, whereas if i plot a point (0,0) on the picturebox it is the centre of the pictureBox.

What i need to understand is how to plot a point(X,Y) on a specific country map in a pictureBox with reference to the world coordinates.

it would be great if u can help me out with this problem..

Edited by bashkaru

0

What i need to understand is how to plot a point(X,Y) on a specific country map in a pictureBox with reference to the world coordinates.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.