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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:02:11+00:00 2026-05-12T17:02:11+00:00

In Google Maps when I set a center through map.setCenter(new GLatLng(28.6589, 77.2104), 13); It

  • 0

In Google Maps when I set a center through

map.setCenter(new GLatLng(28.6589, 77.2104), 13);

It not only sets the centre of the map, but adds a marker on that place which I don’t want it to be.

Update

I feel no harm to share my code, at least it may help others also. Here’s the entire script I wrote

<script type="text/javascript">
    var map;
    function initialize() {
      if (GBrowserIsCompatible()) {


      map= new GMap2(document.getElementById("map_canvas"));


        map.setCenter(new GLatLng(28.6589, 77.2104), 13);
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
       map.clearOverlays();
        //alert(PlottingMarkersDetails);
      }
      setInterval("plotVehicles()",1000);
    }
    function plotVehicles()
    {

     try
        {
            map.clearOverlays();
            var bounds = new GLatLngBounds();
            if(document.getElementById("<%=hf_SelectedVehiclePlottingDetails.ClientID %>"))
            {
            var PlottingMarkersDetails=document.getElementById("<%=hf_SelectedVehiclePlottingDetails.ClientID %>").value;

            var arrVehicleDetails=PlottingMarkersDetails.split("@");
            alert(arrVehicleDetails.length);
            for(var i=0; i<arrVehicleDetails.length;i++)
            {
                var currentVehicleInfo=arrVehicleDetails[i].split(",");

                var point = new GLatLng(parseFloat(currentVehicleInfo[1]),parseFloat(currentVehicleInfo[2]));
                var marker = createMarker(point,currentVehicleInfo[0] + "<br/>" + currentVehicleInfo[4] + "<br/>" + currentVehicleInfo[3] );
                //bounds.extend(point);
                map.addOverlay(marker);

            }
            //map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));

            }
            }

        catch(err)
        {
        }

    }
    function createMarker(point,html) {
    var blueIcon = new GIcon(G_DEFAULT_ICON);
    blueIcon.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png";    
    markerOptions = { icon:blueIcon };            
        var marker = new GMarker(point,markerOptions);
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        return marker;
      }
    </script>
  • 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-12T17:02:11+00:00Added an answer on May 12, 2026 at 5:02 pm

    It looks like your plotVehicles() function is adding the marker. Check the data which that function is pulling from.

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

Sidebar

Related Questions

With google maps api (utlizing there new Places Library)Im trying to: Display a map
I found that the Google Maps API supports Directions through: var map; var directionsPanel;
I am using the new Google Maps v3 STYLED MAP. I want to change
$(function(){ //Location was set. Perform actions. $(#geocodesubmit).click(function(){ var geocoder = new google.maps.Geocoder(); geocoder.geocode( {
I am using Google Maps V3 and I want to: Set the center of
Below is the code listed to set markers in Google Maps. But only one
Im just wondering how to set a default zoom on my google maps application
I just started working using Google Maps API yesterday, and trying to set up
In google maps API v3, I'm creating my own custom map types by calling
I have google map infowindow,i want to set border radius to infowindow. so how

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.