1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Complete code to add Google Maps to your Site in 10 minutes

Discussion in 'C#' started by BurgerKing, Aug 25, 2007.

  1. #1
    Basically, the guys over at subgurim.net have already done all the hard work in writing the .Net wrapper for Google Maps. Problem is, the examples on their site are mostly in spanish & its a bit difficult to find out exactly what is needed to get everything working.

    So here is the speedcode version - 10 minutes & you're done!

    1. Get a Google Maps API key from here:
    http://www.google.com/apis/maps/

    2. Download the SubGurim wrapper dll from here:
    http://en.googlemaps.subgurim.net/descargar.aspx

    3. Unzip it, and put it in your \bin directory

    4. Add it to your toolbox by
    Tools -> Choose Toolbox Items -> Browse -> Select the .dll file -> OK
    GMap will now be in the ‘Standard’ area of your Toolbox.

    5. Add a new webpage.

    6. Drag the GMap from the toolbox onto the page. A new instance of the GMap will appear on the page, with the name ‘GMap1′

    7. Add the following lines to your web.config file:
    <appSettings>
        <add key="googlemaps.subgurim.net" value="YourGoogleMapsAPIKeyHere" />
      </appSettings>
    
    Code (markup):
    8. Add the following code to your Page.Load sub
    Dim sStreetAddress As String
            Dim sMapKey As String = ConfigurationManager.AppSettings("googlemaps.subgurim.net")
            Dim GeoCode As Subgurim.Controles.GeoCode
    
            sStreetAddress = "100 Russell St. Melbourne. VIC. 3000. Australia"
            GeoCode = GMap1.geoCodeRequest(sStreetAddress, sMapKey)
            Dim gLatLng As New Subgurim.Controles.GLatLng(GeoCode.Placemark.coordinates.lat, GeoCode.Placemark.coordinates.lng)
    
            GMap1.setCenter(gLatLng, 16, Subgurim.Controles.GMapType.GTypes.Normal)
            Dim oMarker As New Subgurim.Controles.GMarker(gLatLng)
            GMap1.addGMarker(oMarker)
    
    Code (markup):
    Press F5 and you're done!

    [​IMG]
    SEMrush

    This post is reprinted in full from my blog http://gathadams.com
     
    BurgerKing, Aug 25, 2007 IP
    SEMrush
  2. happydev

    happydev Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    nice job man. thank you


    I have incoeporated googlemap to a US site too, so anyone need help, pls mail me
     
    happydev, Sep 3, 2007 IP
  3. turksweb

    turksweb Peon

    Messages:
    354
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    very nice job man, I will try it. thanks!
     
    turksweb, Feb 18, 2008 IP
  4. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,607
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #4
    ccoonen, Feb 18, 2008 IP
  5. yugolancer

    yugolancer Well-Known Member

    Messages:
    321
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    110
    #5
    ccoonen, i just saw your work. It looks really sweet but, unlike BurgerKing you do not offer any tutorial, code snipet, whatever about how you have done that. Anyway it remains that it's a good work.
    Regards :)
     
    yugolancer, Mar 14, 2008 IP
  6. turksweb

    turksweb Peon

    Messages:
    354
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    turksweb, Mar 16, 2008 IP
  7. imi_99

    imi_99 Peon

    Messages:
    280
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I want to add map for UK property website. will this code will work for uk too.
     
    imi_99, Sep 6, 2008 IP
  8. vihutuo

    vihutuo Well-Known Member

    Messages:
    1,511
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    130
    #8
    vihutuo, Sep 9, 2008 IP
  9. gramyla

    gramyla Peon

    Messages:
    71
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Thanks ye I need this one only And let us see this will work or not on my project.
    Well you did a nice job.
     
    gramyla, Sep 11, 2008 IP
  10. moazzam

    moazzam Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    hi all

    how do you center that map if you mark several lat/long locations?
    whats the formula to dynamically calculate the center of all those
    AND/OR set the correct zoom level to show all markers?

    assuming all locations are within the US.

    thanks a bunch

    Moazzam
     
    moazzam, Sep 30, 2008 IP
  11. DareDevils

    DareDevils Active Member

    Messages:
    607
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    70
    #11
    good point. its a lil bit old but good. tnx
     
    DareDevils, Oct 4, 2008 IP