Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7003259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:02:39+00:00 2026-05-27T21:02:39+00:00

I am trying to get users to mark their places, I am using this

  • 0

I am trying to get users to mark their places, I am using this code below to get user’s postcode and zoom into their neighbourhood but I couldn’t figure out how to get marker coordinates.

I have seen some examples with actionlisteners like this one below but it did not work.

 google.maps.event.addListener(
        marker,
        'drag',
        function() {
            document.getElementById('lat').value = marker.position.lat();
            document.getElementById('lng').value = marker.position.lng();
        }
    );



    var localSearch;
    var map;
    var icon;
    var addressMarkerOptions;
    google.load("search", "1");
    google.load("maps", "2");
    google.setOnLoadCallback(initialize);

    function initialize()
    {
      localSearch = new GlocalSearch();
      icon = new GIcon(G_DEFAULT_ICON);
      addressMarkerOptions = { icon:icon , map: map ,draggable: true};
      map = new GMap2(document.getElementById("map"));
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      plotAddress("M13 0JN");
    }

    /**
    * This takes either a postcode or an address string
    *
    */
    function plotAddress(address)
    {
      localSearch.setSearchCompleteCallback(null, 
        function() {

          if (localSearch.results[0])
          {     
            var resultLat = localSearch.results[0].lat;
            var resultLng = localSearch.results[0].lng;
            var point = new GLatLng(resultLat,resultLng);
            var marker = new GMarker(point, addressMarkerOptions);
            map.addOverlay(marker);
            map.setCenter(point, 15, G_NORMAL_MAP);
          }
          else
          {
            alert('address not found');
          }
        });

      localSearch.execute(address + ", UK");
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:02:40+00:00Added an answer on May 27, 2026 at 9:02 pm

    An excellent tutorial that will show you how to do this (and much more) is posted here …

    See Step 8 about adding a marker.

    BTW you are using the old version / now deprecated of Google Maps API …you should upgrade to V3.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to: get all users by using the query in the below script into
Ok I am trying to get the users First Name the form gets their
I am trying following, 1. Get response using Ajax from the users selection which
I'm trying to get user GUID from Active Directory. My code: DirectoryEntry entry =
I'm trying to get the users current latitude and longitude with this viewDidLoad method.
I'm currently trying to get users to submit data via PHP/HTML forms and into
I'm trying to get input from user using array of structs and then print
I am trying to get CLientID inside the .ascx (user control mark-up) file. While
i'm trying to get the users/lookup for about 400 users using oAuth. The result
I'm trying to get app users in javascript sdk. Why this is not working?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.