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))

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.

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..

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.