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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:29:02+00:00 2026-06-17T21:29:02+00:00

Hi, that’s normal code at Google var map; function initialize() { var latLng =

  • 0

Hi,

that’s normal code at Google

var map;

function initialize()
{
    var latLng = new google.maps.LatLng(41.079120183660486, 28.994637246032653);

    var mapOptions = {
        center: latLng,
        zoom: 8,
        mapTypeId : google.maps.MapTypeId.ROADMAP
    };

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

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

    google.maps.event.addListener(map, 'click', function (event) {
        //map.setZoom(9);
        //map.setCenter(marker.getPosition());

    });


}google.maps.event.addDomListener(window, 'load', initialize);

and I want to multiply marker from my DB and I can’t do it. I searched in site but always result is gray map.

And my code is:

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

    var mapOptions = {
        //center: latLng,
        zoom: 8,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };

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

    var markers = [];

    @foreach (var item in Model)
{
        @:markers.push("@item.map")
        // item.map content coming like this : 41.079120183660486,28.994637246032653
}
    for (var i = 0; i < markers.length; i++) {

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

    //google.maps.event.addListener(map, 'click', function (event) {
    //    //map.setZoom(9);
    //    map.setCenter(marker.getPosition());
    //    //placeMarker(event.latLng);
    //});

}

google.maps.event.addDomListener(window, 'load', initialize);

I can’t add markers. I think missing a lot of things? I really need your opinion. Thanks

  • 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-17T21:29:03+00:00Added an answer on June 17, 2026 at 9:29 pm

    Based on your code, it looks like you’re adding markers to the same lat/lng. The code below adds a few markers in a loop.

    <script>
        var map;
        var center = new google.maps.LatLng(39.715, -84.103);
    
        $(document).ready(initialize);
    
        function initialize() {
            // Create map
            var mapOptions = {
                zoom: 10,
                center: center,
                panControl: false,
                zoomControl: true,
                mapTypeControl: true,
                scaleControl: true,
                streetViewControl: true,
                overviewMapControl: true,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            map = new google.maps.Map($('#map_canvas')[0], mapOptions);
    
            for (var ii = 0; ii < 5; ii++) {
                var lat = center.lat() + (0.1 * ii);
                var lng = center.lng() + (0.1 * ii);
                var loc = new google.maps.LatLng(lat, lng);
                var marker = new google.maps.Marker({
                    position: loc,
                    map: map
                });
            }
        }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

that's part of my script: var count = $(.sliderItem).length; if (count < lp +
That's how I'm new in here on the website so it would be super
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That is my select function: public function search($for) { $q = $this->select()->from($this->_name, array('id', 'title',
That's my question, and here's my example code. HTML: <a class=fancybox rel=group href=img1.jpg> <img
That is my Controller Helper: class Application_Controller_Helper_Test extends Zend_Controller_Action_Helper_Abstract { public function preDispatch() {
That's my code <EditFormSettings PopUpSettings-Width=500 EditFormType=Template> <FormTemplate> <asp:DropDownList ID=Status DataSourceID=TerminalStatusDTS DataValueField=STATUS_ID DataTextField=STATUS_NAME runat=server Width=175px
That is my function: int main() { double data[100]; int num; cout<<num= ; cin>>num;
I need a function that will clean a strings' special characters. I do NOT
that seems tricky. My IPad freezes and it seems that this line of code

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.