locked
Vb.net Coordonates to google map from your vb.net project RRS feed

  • Question

  • Hello i want to make a program that you insert in a textbox or something the coordonates and when you press a button automaticly search on google maps that coordonates.
    Sunday, June 18, 2017 11:03 AM

All replies

  • You just display in a WebBrowser :

    https://www.google.com/maps/preview/@<latitude>,<longitude>,<zoom level>z

    for example, for Paris in France :

    https://www.google.com/maps/preview/@48.8557113,2.5178095,10z


    • Edited by Castorix31 Sunday, June 18, 2017 11:11 AM
    Sunday, June 18, 2017 11:11 AM
  • Hi Cipichao,

    You want to  find a location on a Google map, you could use Google Geocoding API. The purpose of this API is to convert a written address into a geographic coordinate. A geographic coordinate is expressed in Latitude and Longitude.

    Here is an article about search a location on Google map, please refer to:

    http://www.codeguru.com/columns/vb/using-google-maps-with-visual-basic-2010.htm

    Hope it is helpful to you.

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, June 20, 2017 7:13 AM
  • Hello i want to make a program that you insert in a textbox or something the coordonates and when you press a button automaticly search on google maps that coordonates.

    Does it have to be Google Maps?

    Bing Maps does a pretty impressive job too:

    https://msdn.microsoft.com/en-us/library/dd877180.aspx


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Tuesday, June 20, 2017 12:00 PM
  • Hi Cipichao,

    You want to  find a location on a Google map, you could use Google Geocoding API. The purpose of this API is to convert a written address into a geographic coordinate. A geographic coordinate is expressed in Latitude and Longitude.

    Here is an article about search a location on Google map, please refer to:

    http://www.codeguru.com/columns/vb/using-google-maps-with-visual-basic-2010.htm

    Hope it is helpful to you.

    Best Regards,

    Cherry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Cherry,

    Stop doing that. Marking yourself as the proposed answerer is both rude and pointless - yet you do it all the time.

    If you then later come back and mark yourself as the answerer, I can only conclude that Microsoft must have a rigged game going on here? What's next? Three-card monty?


    "A problem well stated is a problem half solved.” - Charles F. Kettering

    Wednesday, June 21, 2017 11:18 AM
  • Hello i want to make a program that you insert in a textbox or something the coordonates and when you press a button automaticly search on google maps that coordonates.

    You can create a map point file and start Google earth by pointing to that file.   This example already has the coordinates in some variables (ClkPointLat, ClkPointLon) - you will have to get the information from the text boxes in the correct format and change the validation.

            If ClkPointLat = 0 Or ClkPointLon = 0 Then
                MessageBox.Show("You must click on a point in the display before trying to view it in Google Earth", "Viewer", MessageBoxButtons.OK)
                Exit Sub
            End If
            Dim DefM As String = "Chart Clicked Point"
    
            Dim cmd As String
            cmd = "<?xml version=" & Chr(34) & "1.0" & Chr(34) & " encoding=" & Chr(34) & "UTF-8" & Chr(34) & "?>" & vbCrLf
            cmd &= "<kml xmlns=" & Chr(34) & "http://earth.google.com/kml/2.1" & Chr(34) & ">" & vbCrLf
            cmd &= "<Placemark>" & vbCrLf
            cmd &= "<name>Chart Clickpoint</name>" & vbCrLf
            cmd &= "<description>" & DefM & "</description>" & vbCrLf
            cmd &= "<Point>" & vbCrLf
            cmd &= "<coordinates>" & ClkPointLon.ToString & "," & ClkPointLat.ToString & ",2000</coordinates>" & vbCrLf
            cmd &= "</Point>" & vbCrLf
            cmd &= "</Placemark>" & vbCrLf
            cmd &= "</kml>"
            Dim m_FileName As String = ""
            Try
                ' Return the path and name of a newly created Temporary
                '   file. Note that the GetTempFileName() method actually creates
                '   a 0-byte file and returns the name of the created file.
                m_FileName = Path.GetTempFileName()
                ' Create a FileInfo object to manipulate properties of 
                '   the created temporary file
                Dim myFileInfo As New FileInfo(m_FileName)
                myFileInfo.Attributes = FileAttributes.Temporary
                myFileInfo.Delete()
                m_FileName = m_FileName.Replace(myFileInfo.Extension, ".kml")
            Catch exc As Exception
                ' Warn the user if there is a problem
                MessageBox.Show("Unable to create a TEMP file or set its attributes.", "Viewer", MessageBoxButtons.OK)
                Exit Sub
            End Try
    
            Dim st As Stream = File.Open(m_FileName, FileMode.Create, FileAccess.ReadWrite, FileShare.None)
            Dim sw As New StreamWriter(st)
            sw.AutoFlush = True
            sw.Write(cmd)
            sw.Close()
    
            System.Diagnostics.Process.Start(m_FileName)
    
            Exit Sub

    Wednesday, June 21, 2017 10:46 PM