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 7846859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:43:55+00:00 2026-06-02T17:43:55+00:00

Hey guys hoping for a little help here. First I created a working map

  • 0

Hey guys hoping for a little help here.

First I created a working map here: http://leongaban.com/_stack/googlemaps/firstmap.html
Pointer is shown on the spot, however I needed to remove the Map | Satellite | Terrain buttons.

Digging a bit deeper I found an example here disablingDefaults. However I could not get the map to work using my google.map.js file and my API key. So I just used the script from Google’s example page.

Now my 2nd map I have the Map view options removed, but cannot get an overlay to show up 🙁
http://leongaban.com/_stack/googlemaps/

Please Help!

Goals:

  • Use my Google maps API key
  • Remove the Map view option buttons
  • Put overlay pointer on the location.

Code for my first map with my google API 2 key:

<head>
    <title>Test Google Maps</title>

    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=AIzaSyAXsNu2EwRNqKJn9OmC19WPkEJFM0r6ALk&sensor=true"
        type="text/javascript"></script>

    <script type="text/javascript">

        function initialize() {

            // var myOptions = {
            //     zoom: 16,
            //     center: new google.maps.LatLng(40.750159, -73.976473),
            //     disableDefaultUI: true,
            //     mapTypeId: google.maps.MapTypeId.ROADMAP
            //   }

            // var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

            // var point = new GLatLng(40.750159, -73.976473);
            // map.addOverlay(new GMarker(point));

            var map = new GMap2(document.getElementById("map_canvas"));
            map.setCenter(new GLatLng(40.750159, -73.976473), 13);
            map.setUIToDefault();

            var myGeographicCoordinates = new GLatLng(40.750159, -73.976473)
            map.addOverlay(new GMarker(myGeographicCoordinates));

            // map.addOverlay(new GMarker(40.750159, -73.976473));


        }

    </script>

</head>

<body onload="initialize()" onunload="GUnload()">
    <div id="map_canvas" style="width: 450px; height: 370px"></div>
</body>

UPDATED
WORKING CODE! THANKS STACKERS!!!

<head>
    <title>Test Google Maps</title>

    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>

    <script type="text/javascript">

        function initialize() {

            var myOptions = {
                zoom: 16,
                center: new google.maps.LatLng(40.750159, -73.976473),
                disableDefaultUI: true,
                mapTypeId: google.maps.MapTypeId.ROADMAP
              }

            var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

            var myGeographicCoordinates = new google.maps.LatLng(40.750159, -73.976473);

            var marker = new google.maps.Marker({
                map:        map,
                position:   myGeographicCoordinates,
                title:      "My First Test Marker",
                visible:    true
            }); 
            }

    </script>

</head>

<body onload="initialize()" onunload="GUnload()">
    <div id="map_canvas" style="width: 450px; height: 370px"></div>
</body>
  • 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-06-02T17:43:57+00:00Added an answer on June 2, 2026 at 5:43 pm

    There’s a problem with how you define your latLng objects.

    new GLatLng(40.750159, -73.976473);
    

    That was used with Google Maps Api v2. Now you’re using the latest api(v3), and in new api, this is how you should do it:

    new google.maps.LatLng(40.750159, -73.976473);
    

    EDIT: After your edit, i see there are some problems with the marker. In API v3 this is how you make a new marker:

    var marker = new google.maps.Marker({
        map:        map,
        position:   latLng
    });
    

    Following code sets a map, disables default UI, sets a marker and put it on the map;

    function initialize() {
     var myOptions = {
      zoom: 16,
      center: new google.maps.LatLng(40.750159, -73.976473),
      disableDefaultUI: true,
      mapTypeId: google.maps.MapTypeId.ROADMAP
     }
    
     var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
     var myGeographicCoordinates = new GLatLng(40.750159, -73.976473);
     var marker = new google.maps.Marker({
      map:        map,
      position:   myGeographicCoordinates
     });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys I'm following the rails tutorial found here http://net.tutsplus.com/tutorials/ruby/the-intro-to-rails-screencast-i-wish-i-had/ and I've gotten to
Hey Guys, here is my code for this, the only help i get from
Hey im working on my first php site, and was hoping to get some
Hey guys, hoping for some help with this :( been stuck on it for
hey guys here at stackoverflow.com I'm a student and developing a small todo app
Hey guys, first time using stackoverflow. can you guys help me debug? Heres the
Hey guys, I'm working on a project. I need to use the function cvFindHomography
hey guys, how can I just achieve this simple layout? I'm hoping the answer
Hey guys, I've spent hours looking at this, and am hoping a fresh pair,
Hey guys I have my script here that is supposed to do some stuff

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.