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

  • Home
  • SEARCH
  • 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 7637081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:51:07+00:00 2026-05-31T07:51:07+00:00

I am trying to display a marker for an address that the user enters

  • 0

I am trying to display a marker for an address that the user enters in a web form. The problem is that I am getting the following error

Cannot call method ‘getSouthWest’ of undefined

when I try to show the marker using the following code:

    var geocoder = new google.maps.Geocoder();
    geocoder.geocode({ 'address': address }, function (results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
            var latitude = results[0].geometry.location.lat();
            var longitude = results[0].geometry.location.lng();

                //Remove all markers from the map
            clearMarkers();

                //Display the new marker on the map
            showFullAddressesOnMap(latitude, longitude, address);

            //Center the map according to the marker
            map.fitBounds(results[0].geometry.bounds);                      
        }
    });

function showFullAddressesOnMap(latitude, longitude, fullAddress) {
    displayMarker(-1, "", "", "", fullAddress, true, latitude, longitude);
}

function displayMarker(appID, title, image, imageType, address, markerType, lat, lng) {

    var listingLatLng = new google.maps.LatLng(lat, lng);
    var marker = new google.maps.Marker({
        position: listingLatLng,
        map: map,
        icon: markerType ? imgBluePin : imgGreenPin,
        title: title + address
    });

    var content = GetContent(appID, title, image, imageType, address);

    marker.info = new google.maps.InfoWindow({
        content: content,
        size: new google.maps.Size(50, 50)
    });

    google.maps.event.addListener(marker, 'click', function () {
        closeAllWindows();
        marker.info.open(map, marker);
    }); 

    bounds.extend(listingLatLng);
    map.fitBounds(bounds);

    markers.push(marker);
}

Also, the error does not happen every time. Here is an address that crashes the code.

France, Ile-de-France, Paris, 75006, Paris, 7 rue casimir delavigne

I think the error is caused when FitBounds is called. When the error happens the bounds that are returned by the geocoding is zoomed out to Province level.

What is the cause of the error? I need to zoom the map to street level when the user enters address with street name.

  • 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-31T07:51:09+00:00Added an answer on May 31, 2026 at 7:51 am

    bounds isn’t defined somewhere.

    You must define it in a scope where it is accessible by displayMarker, before you use it’s methods or use it as argument for methods:

    bounds=new google.maps.LatLngBounds();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to display some files in a web page so the user can
I am trying to display data that I am getting from server through json.
I'm trying to display an address as a marker on a google map element
I am trying to display my popover menu whenever the user clicks on a
I'm trying to display a fiew lists in a FlowDocument. I Realized that when
I'm experiencing a problem while trying to use google maps api v3 (with marker
I'm trying to set up a Google map that will display when a link
I'm trying to display photos as markers on Google Maps. This is no problem
I'm trying to set up a form where the user can click on a
I'm trying to display markers that I have created in a MapView in a

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.