locked
Subgurim GMap Control: Pulling Coordinates of "Placemarker" and inserting them into a database RRS feed

  • Question

  • User-359420042 posted

    I have just got my Gmap control working and have implemented it as part of a form where the user inputs their location for the event they are planning (it's a book club meeting website) and a little google maps preview pops up with their location and the placemarker. I would like to insert the coordinates of the address that they have just entered into the database and retrieve those coordinates at a later date.


    I hope someone here is familiar with Subgurim GMap as I'm definitely not!

    Anyway here is my client side code:

                        <p style="text-align:right; margin-right:300px">
        &nbsp;Address:
        <asp:textbox ID="txtStreetAddress" runat="server" Width="150px" /><br />
        Suburb:
        <asp:textbox ID="txtSuburb" runat="server" Width="150px" /><br />
        Country:
        <asp:textbox ID="txtCountry" runat="server" Width="150px" /><br /><br />
        <asp:Button Text="Show On Map" ID="lnkShowMap" runat="server" />
    </p>
                    <p>
                        &nbsp;<cc1:GMap ID="GMap1" runat="server" GZoom="4" Height="200px" Width="250px" />

    And here is my subroutine:

        Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Dim conn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("BookMeetConnString").ConnectionString)
            conn.Open()
            Dim cmd As New OleDbCommand("INSERT INTO Events (EventTitle, EventDescription, EventDate, EventCategory, CreatedBy, Coordinates) VALUES (@f1,@f2,@f3,@f4,@f5,@f6)", conn)
            cmd.Parameters.AddWithValue("@f1", tb_eventtitle.Text)
            cmd.Parameters.AddWithValue("@f2", tb_eventdescription.Text)
            cmd.Parameters.AddWithValue("@f3", DateTime.ParseExact(tb_eventdate.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture))
            cmd.Parameters.AddWithValue("@f4", dd_eventcategory.SelectedIndex + 1)
            cmd.Parameters.AddWithValue("@f5", User.Identity.Name)
            cmd.Parameters.AddWithValue("@f6", GMap1.getGMapEleme
            cmd.ExecuteNonQuery()
            conn.Close()
            Response.Redirect("calendar.aspx")
        End Sub

    As you can see, I haven't got very far with the Gmap (@f6) parameter. This is where you guys come in!

    VB.NET responses preferred!, or error-free C# will suffice as long as I can convert it!

    Thanks in advance,

    Adam

    Wednesday, April 10, 2013 10:45 PM

All replies

  • User1508394307 posted

    If you look at their web site, you can get an example of the inverse Geocoding. There is the initialPoint property, which is probably you can use too.

    Hope this helps.

    Thursday, April 11, 2013 5:41 PM