SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist tangledman's Avatar
    Join Date
    Sep 2005
    Location
    Puerto de Mazarron, Murcia, Spain
    Posts
    425
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool Google Maps - Get coordinates from a user

    Hey Guys and Gals,

    I want a user to be able to move zoom in on a google map and move a pointer so that i can capture the coordinates.

    Does anyone know how to do this?

    Thanks

    Will

  2. #2
    SitePoint Member
    Join Date
    Feb 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    All you need to know is here:
    code.google.com/apis/maps/documentation/

    the code is pretty simple - if you look at Draggable Markers under map overlay
    Code:
    var map = new GMap2(document.getElementById("map_canvas"));
    var center = new GLatLng(37.4419, -122.1419);
    map.setCenter(center, 13);
    
    var marker = new GMarker(center, {draggable: true});
    
    GEvent.addListener(marker, "dragstart", function() {
      map.closeInfoWindow();
      });
    
    GEvent.addListener(marker, "dragend", function() {
      marker.openInfoWindowHtml("Just bouncing along...");
     // Here you can add your capture information - for example feed 2 hidden text elements 
    });
    
    map.addOverlay(marker);

  3. #3
    SitePoint Evangelist tangledman's Avatar
    Join Date
    Sep 2005
    Location
    Puerto de Mazarron, Murcia, Spain
    Posts
    425
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    I managed it...and it works fantastically well.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •